Lab 1

Contents

  1. Lab 1
    1. Activate Your CSE Account
    2. Getting Online
    3. Course homepage
      1. Undergraduates
      2. Postgraduates
      3. All
    4. CSE Email
      1. If you forward to your zMail [default]
      2. If you want to keep your CSE email separate
      3. All
    5. Working with the terminal
    6. Your First Program
  2. Uniwide
  3. Setting Yourself up for Home Computing

Today you'll be setting up your CSE account, doing a few basic things in Linux, writing some code, and submitting your first assessment. We're hoping that you'll learn enough today to get you through the semester.

Your CSE account is very important, as most CSE lecturers will use this as a primary way to communicate with you. It is also what you will use to submit your CSE assignments throughout your degree, and it gives you access to the 17 CSE labs on campus. We recommend that you safeguard your password closely.

Activate Your CSE Account

  1. Know your student ID number and unipass
  2. Login (as a new user) to one of the computers in the lab
  3. In the next few days you will be emailed the yellow form.

Getting Online

When you log in, you'll get a blank screen, perhaps with a couple of terminals open, and a bar at the bottom. This is the fluxbox window manager.

Fluxbox has a simple menu you can access by right-clicking anywhere on the desktop. Have a look around the menu, and open up a web browser. It's under Applications -> Network -> Web Browsing -> Iceweasel
(Note: If you are using another Window Manager, like Gnome, it might be under Applications -> Internet -> Epiphany Web Browser)

Course homepage

The first place you want to visit is the homepage for your CSE course. This is where you go to get lecture slides, assignment specifications and updates, and important announcements. You may also want to take note on who your tutor is and note down contact details in case you have questions about course content.

Undergraduates

If you're enrolled in a CSE degree, you should be in COMP1917, it's homepage is at:

http://www.cse.unsw.edu.au/~cs1917/

Postgraduates

Even if you are not enrolled in COMP9021, go to http://www.cse.unsw.edu.au/~cs9021/ where you will find an introduction to Unix.

More generally, go to the homepage of any of the courses you are enrolled in (by replacing 9021 with the right four-digit number) in order to familiarise yourself with the course outlines, that should be accessible from the corresponding homepage.

All

Browse around your course homepage, and see if you can find out who your tutor is, and what their email address is.

CSE Email

By default, your CSE mail will redirect to your zMail. This means you only have to check one email, but you have to check it, as your lecturers will contact you at your CSE mail often and expect you to read it.

If you forward to your zMail [default]

If you use zMail, be sure to login to Identity Manager and zMail to check your settings.

If you want to keep your CSE email separate

You can disable the default forward at https://status.cse.unsw.edu.au/Control_Panel/Mail/Forwarding You may forward your zMail to your CSE mail, which can be configured at http://idm.unsw.edu.au. Other email options are described at http://taggi.cse.unsw.edu.au/FAQ/New_to_CSE

All

Anyone enrolled in a CSE course should check their email account at least once a day. Important information from your lecturers, course administrators and student societies are sent here.

Working with the terminal

Now for the fun part! If you get stuck with any of this, don't hesitate to ask one of the Lab 0 supervisors for help, that's why we're here!

If there isn't a terminal open, right click on the desktop to bring up the Fluxbox menu, and click 'Applications -> Terminal Emulators -> XTerm'.
(or it might be Applications -> Accessories -> Terminal)

This will bring up a window where you can type commands.

There are a few commands you can use to check your account details:

ipq tells you how much of your internet quota you've used up (from browsing the web) rquota tells you how much of your disk quota you've used up (from creating files) pp tells you your name, what classes you're in, where your home directory is, how much print quota you have and how much ip quota you have.

Each of these is a command, and when entering into your terminal, you need to press enter (or return) after each command. Try the three we just mentioned above.

Now we're going to learn about 4 commands for working with files: pwd, ls, mkdir and cd, and one text editor gedit.

pwd stands for Present Working Directory, and it tells you where you are. If your username is 'z7654321', and you enter the 'pwd' command into the XTerm, it might tell you:

/import/cage/1/z7654321

This means I'm in z7654321's home directory (sort of like My Documents, where you keep all your files), and my home directory is stored on the fileserver called 'cage'. What does pwd say for you?

ls prints a list of the files in the present directory. You have a fresh account, so your home directory contains only your website, in a directory called public_html.

mkdir makes a new directory (directories are like folders in windows).

type:

mkdir 1917

(or cs1911 if you're a 1911 student, or cs9021 if you're a 9021 student), to make a directory to keep your work for that subject.

now type:

ls

again, and you should be able to see the directory you just created

cd stands for 'change directory', to move into the new directory you just created, enter each of these three commands:

cd 1917
mkdir lab1
cd lab1
pwd
ls

The 'pwd' should confirm you've now moved into your new directory, and 'ls' will confirm that it's empty. Now it's time to make a file.

Your First Program

Type:

gedit hello.c &

This will open up a graphical editor where you can manipulate text. The ampersand (&) means that you want to also continue typing commands into the Terminal window. When you save, it will place the contents of the editor into the file 'hello.c'. C is the programming language you'll be learning this semester, here's a simple example of C, copy it into the gedit window, and save. :-)

#include <stdio.h>

int main( void ) {

   printf("Hello World!\n");

   return 0;
}

Once you have saved, click on the Terminal window again and type these two commands:

gcc -Wall -o hello hello.c
./hello

The first command should have no output. Generally, no output means no problems. Hopefully the second command will say "Hello World!".

(!) Congratulations, you've just compiled your first computer program on a CSE machine!

When you wish to leave, make sure you log off! To do this, right click anywhere on the desktop, and select 'Exit' from the menu. (or choose System -> Log Out..)


Uniwide

There is free WiFi with no download quota covering most of UNSW called uniwide. You can find setup instuctions for uniwide here(http://www.it.unsw.edu.au/students/uniwide/index.html).


Setting Yourself up for Home Computing

Once you have completed these exercises, it might be a good time to set yourself up for HomeComputing.