COMP1011 Exercises for Week 01
Computing 1A 05s2 Last updated Tue 19 Jul 2005 14:37

Lab Exercises Week 1

This lab is to be done in your own time in Week 1.

You may find these first laboratory exercises strange or unfamiliar. Do not worry. This is common at first. Just go slowly and carefully and don't be afraid to experiment or redo things which don't quite work the first time.

If something unexpected or puzzling happens or you are not sure what to do, ask another student. If you have troubles you can't solve, you can ask your tutor in Week 2.

Logging In

Sit in front of a terminal. If the screen is blank, move the mouse to wake it up. In the centre of the screen, there should be a message indicating the name of the laboratory you are in and asking for your account name and password.

(If you have not logged in before, you will need to obtain an account name and password. To do this, type "sirius" as the account name and press the Enter key. For the password, simply press the Enter key. You will then be given a set of instructions to follow. Once these are complete, proceed with the rest of the lab.)

Login using your UNIX account name and password. If you have forgotten these you will have to go to the help desk (in Mechanical Engineering Undercroft).

Once you are logged in two or more windows will appear on the screen. These are called terminal windows. You can type Unix commands in a terminal window and it will process them one at a time.

Move the mouse and watch how the mouse pointer moves. Notice how the pointer changes shape as you move it about the screen.

Interactive commands often print some characters, called a prompt, to indicate they are ready for your input. What characters does a terminal window print to indicate it is ready for your next command?

Using the terminals

1. Moving a window

Use the mouse to move the cursor onto the title bar at the top of a terminal window.

Notice the terminal window moves about.

2. Resizing a window

Notice the cursor change into a "corner" shape. Notice the size of the terminal window changes.

3. Scrolling down a desktop Menu

Some frequently used commands can be run without typing their names.

A list of commands should appear on the screen. Notice different command names are highlighted as the cursor moves over them. Move the cursor to any command and explore what each command (eg, xterm) does.

Accessing the Subject Home Page

In a terminal, type the command mozilla &

This runs the web browser Mozilla. Go to the course home page All the information about COMP1011 can be found on this web page.

Reading and sending mail

It is essential for you to be able to read your email, as it will be the primary form of communication between lecturers, tutors, and students. If you already know how to use Mozilla mail, or any other mail program on the system, feel free to continue using it. Otherwise, follow these instructions.

Send an email message to someone you know, even to yourself if you like. Your email address is your unix login name followed by

Using Unix

1. dates

You have just run the Unix command date. Look at the output. It displays the current date and time.

What does this tell you about the names of Unix commands?

What day of the week were you born on? Now find out how many days there were in September 1752. (This was a strange month.)

2. ls

Enter the command ls in a terminal. What is the result?

The ls command is used to list the files in the current directory (in windows directories are called folders). When you first login the curent directory is your own special home directory. You should see you have a file called public_html in your home directory. public_html is a subdirectory of your home directory. You will shortly create a file and save it in your public_html directory.

3. Changing directory

If your previous ls command did not show a listing of public_html then enter the command mkdir public_html. This creates a new directory, called public_html.

You have just changed into the public_html directory.

4. Creating a file

You will now create a file within your public_html directory

A few moments later a window for the text editor xemacs will appear on your screen. The xemacs window consist of three parts. On the top, there is the menubar (it contains menu headings like "Buffers", "Files", and so on.) Below the menu bar, there is the main space in which we can edit files. On the bottom of the window, there is the one-line minibuffer. Xemacs uses it to display status messages and sometimes for inputting names of files that you want to load or save, or other information.

5. Saving the file

Now check what has happened.

You should see that a file named `aboutme.html' now exists.

We are finished with xemacs, so you can make it exit.

The xemacs window should disappear.

6. Changing file access permisions

The file permissions, shown on the far left, for the file aboutme.html should look like this:


The last three characters tell you what permissions other people have to access this file. r means thay can read it, w means they can write to it and change or delete it, and x means they can execute it. - means nothing. The last 3 characters are currently --- which means no-one else, but you can access this file.

The file permissions should now look like this


Other people can now read your file, but they still can't change it or execute it.

The cd command used on its own will take you to your home directory.

How is the output different to what it was prior to executing the chmod command?

Your tutor will ask you to show them the file aboutme.html in your Week 2 lab and you will then get a mark for this lab.

7. Getting to know Emacs better

To learn more about xemacs, start the editor again.

When using the menubar, you will notice that many menu items have key sequences at their right side. This means that, to invoke the corresponding action, you can use the indicated key sequence, instead of clicking on the menu items with the mouse. After some practise, you will find that using key sequences is much faster than using the mouse. Therefore, expert computer users prefer the use of key sequences over excessive mouse use.

8. Starting GHCi

Now try to use the interactive Glasgow Haskell Compiler system (GHCi):

You will be using GHCi a lot during the next couple of weeks.