A Basic Tutorial for Getting Around in UNIX

To access the cluster you will first need an ‘ssh client’ that gives you a terminal window. If you’re working on a PC, download and install the correct version of Putty for your operating system, from www.putty.org
Run putty and direct it to make a connection to: login.cluster.tufts.edu , then login with your UTLN and password.

If you are working on a Mac, simply open the “Terminal” application that comes with OSX. Then type:
ssh myaccoun01@login.cluster.tufts.edu [where myaccount01 is your Tufts UTLN]
When prompted, enter your password.

**Note that the Unix cluster is undergoing an upgrade. During the upgrade you will also be able to use the old login addresses: either cluster.uit.tufts.edu or cluster6.uit.tufts.edu. However, these will be retired in a few months.

READ THIS BEFORE PROCEEDING: Conventions for this tutorial: all UNIX commands are in bold. Commands you should try entering are in red. Comments and explanations are in [] square brackets. User specific information that you’ll need to adjust for your situation is in {} brackets. Output from the computer to your screen is in green.

Once you’re logged in, to find out the directory you are currently looking at type:

pwd      [and hit return or enter, which tells the computer to execute the command you typed]

[note that everything in UNIX is case sensitive, so the system will not respond correctly if you typed ‘Pwd’ or ‘PWD’]

the system will respond something like:


Your current directory/folder is myaccount01 which is several directories down from the highest root directory /

To change directories use the command ‘cd’ and tell it the path you want to go to:

cd {/cluster/home/m/a}         [modify the part in {} based on the pwd output. note: ‘cd’ stands for ‘change directory’]

To find out what’s in a directory type:

ls          [‘ls’ stands for ‘list’]

you’ll see all of the subdirectories, one of which will be yours; myaccount01

Or if you want more details type: ls -l, which will show you file size, date & time of last access, etc.

There are many shortcuts for specifying directory paths:

To go to a subdirectory from your current directory type: cd subdirectory_name, e.g. cd myaccount01.

To go up one level of a directory type: cd ..     or to go up two levels type cd ../..

Your home directory has somewhat limited storage space. If you need more space for a short term analysis (less than 4 weeks) you can go to your assigned space in the ‘shared’ directory by typing:

cd {/cluster/shared/myaccoun01}

Beware that files in your shared directory that you haven’t used in over 4 weeks will be erased from the system, so don’t put things here that you can’t afford to lose.

To go to your home directory (where you started when you logged in) from wherever you happen to be use:

cd ~

In your home directory (or your shared directory) you can create or delete files and directories, to create a new directory type:

mkdir mydirectory

now if you type ls you’ll see the new directory in the list

to remove an empty directory you would type:

rmdir directory_name [don’t do that right now, though]

To create another type of file you’ll need to enter the ‘vi’ editor and supply a new file name:

vi myfile.txt

You’ll see a bunch of tildes (~) on the side and a note on the bottom saying ‘myfile.txt’ is a new file.

To enter text type ‘i‘ (for insert, just the single i key, not the quotes)

Enter a few lines of text to get the feel of it. You can use the arrow keys to move around.

To stop entering text hit the escape key [esc]

Now you’ve left text editing and can enter other vi commands

To save what you wrote and exit you would type: ‘:wq‘ [don’t do this yet, note that the colon is required]

To save under a different name you would type ‘:w myfile2.txt’

To leave without saving type: ‘:q!‘ [don’t do this right now]

Now use ‘:wq‘ to exit and save. Now you’re back at the UNIX prompt. If you type ‘ls’ you’ll see your edited file.

If you want to rename your new file, type:

mv myfile.txt newname.txt      [where mv stands for move]

If you want to move the file to another directory you use the same command but instead of a new filename you use the name of a subdirectory or supply a directory path (e.g. to move a file up one directory the path would be ‘..’), for now do:

mv newname.txt mydirectory

Now your file has been moved into ‘mydirectory’. Do cd mydirectory to go there. You can confirm that this worked using pwd. Now if you type ls you’ll see the moved file ‘newname.txt’. If you wanted to further edit the file, you’d type ‘vi newname.txt‘.

To see the contents of that file (without editing it) type:

cat newname.txt

If the file is long you might want to instead do:

more filename

[the first screen’s-worth of the file will be displayed.]

To see the next screen hit [space]

To stop viewing the file type: control-c [hold down the ctrl key and hit c]

Alternatively you can look at just the first 10 lines of a file using:

head filename

To remove any file, type:

rm filename

Some useful tricks for entering commands:

If you want to redo a command you previously entered use the up and down arrow keys to review your previous commands. If you find the one your want just hit [enter] to use it.

If you ever type a command and don’t want to use it, you can just erase it using the backspace/delete key, or hit control-c [hold down ctrl and hit c]

On a Mac, you can cut and paste commands from another file (such as this tutorial) using the normal copy and paste method [apple-key/command]c and [apple-key/command]v.

On a PC this is a bit trickier, since the normal copy command, control-c, is also the ‘abort entry’ command in UNIX. To get around this, in Putty, use the right button on your mouse. First copy from the other source with ctrl-c, then right click. To copy something that shows up in your terminal session, use the mouse to select it/highlight it, then right click.

When you’re done with your session, type:

logout [or simply close or exit your terminal program]

That’s all of the basic commands that you’ll need to navigate around your cluster account, and create or manage files and directories.