This document attempts to help you with connecting to and using a Unix server here in Auckland Uni.
Our central Unix server for the Faculty of Science is login.fos.auckland.ac.nz which we Computer Science people use. The instructions in this document briefly describe some of the common tasks such as connecting to the server and transferring files to and from it.
We need to connect to the server using an SSH (secure shell) client.
If you have a Linux or MacOS computer, you are in luck. You already have the client called ssh. All you do is to open a terminal window, and type in the following command to get a shell on the server.
ssh login.fos.auckland.ac.nz -l upi123
If you are less fortunate to have a Windows machine, then you will need to download and install an SSH client. In the labs, we have an SSH client called PuTTY, and I suggest that you install the same on your machine.
If you then launch PuTTY, you get an application window as shown below where you type in login.fos.auckland.ac.nz at the host name. Leave the rest of the options at default, and click open.
At this stage, you get a console where you will be asked to type in your user name (at "login as:") and password. Furnishing the right credentials will connect you to the server, and you will get a terminal window as shown below
Once you have a connected terminal session, you will be in your Unix home directory. Unix (like many other operating systems) has a tree like directory structure. A directory can contain directories and files. You can change from one directory to another by using the command cd (change directory).
Your Unix home directory is different from your SONAS directory or H: drive (where your files exist when you use Windows in the lab). So the files you have in your SONAS directory will not be there in the Unix home directory. But, do not worry, your Windows files are only a cd away.
If you cd (change directory) to /mnt/YOUR_UPI/sonas using the command cd /mnt/YOUR_UPI/sonas, then you will see the files you normally see in Windows. See the screenshot below.
If you are using Windows, probably the easiest way to transfer files is through your EC home which is accessible from the Unix server. You may find AFS web handy, if you want to browse/upload files through a browser to your EC home. See below.
With Linux and MacOS, you can transfer files directly to/from your Unix home directory using the secure FTP client sftp from a terminal window.
sftp upi123@login.fos.auckland.ac.nz
See how I typed in a simple "hello world" program using the command cat in the screenshot below. What I typed in went to a file named hello.cpp. I then compiled the program using the GNU compiler: g++ hello.cpp , and ran the resulting executable file called a.out using ./a.out. What the ./ in front of that command means the current working directory. In other words, we request executing the file a.out in the current working directory.
If I use cat > hello.cpp to type in (or paste in), then I need to end the input with Ctrl-D (control + D). Ctrl-D specifies end-of-file or end-of-input.
Note that g++ is an alias to gcc -lstdc++. In other words, g++ invokes the GNU compiler gcc and instructs it to use the standard C++ library at link stage. Therefore g++ hello.cpp and gcc -lstdc++ hello.cpp are equivalent commands.
Voila, that's all for the brief introduction. Bon chance!