Command-line Help


For information on logging on to the cluster, go here. If you are unfamiliar with UNIX-like operating systems, you should read the rest of this page before you try to log in.

When you use the cluster you will be working in a Linux environment (using a bash shell) and will interact with the cluster using a command-line interface. When you log on you will be in your "home" directory. Within this directory you can add and delete files, create and delete directories (or folders), execute commands, and run scripts.

In case you are not familiar with working at the command-line in a Linux environment, a few commands and tips are provided below. This should help you accomplish what you need to do on the cluster. In case you are wondering, commands are just simple programs.

Where is the command-line?

If you are working on an OS X computer, open the program called Terminal. It is in a folder called Utilities within the Applications folder. Terminal is a program that works with the shell to interact with rest of the operating system (be it a local or remote system). You will use Terminal to connect to and work on the cluster. On a Windows computer, you can also connect to and work on the cluster. Two free Windows programs that will allow you to do this are PuTTY and Cygin.

To execute a command, type the command at the cursor (the command-line) and press enter.

The commands provided are just a few of a great many. In most cases, commands have options. To view more about a command and to get a list of its options, type "man commandname". This will produce a "man (manual) page" for the command. Use the up and down arrow keys to move line by line within the man page or the space bar to page down. Type "q" to quit the man page and return to the command-line.

Uploading and Downloading Files:

To upload and download files into your home directory you must use sftp (secure file transfer protocol). The easiest way to sftp files into and out of your home directory is to use a program with a graphical interface - Fugu (OS X) is a good one. Some prefer Cyberduck (OS X). Both of these work much like the Finder and are free! A free Windows sftp program is WinSCP. When you sftp, you will need to supply your gateway ID and cluster password.

You can sftp files from the command-line. There are many commands within sftp. Please consult the sftp man pages ("man sftp") if you want to use it.

Note that to sftp (and ssh) to the cluster you must be working on a computer that is part of the UMSL network. You can get around this if you have an UMSL VPN account. Start the VPN and then connect as normal.

Manipulating Directories and Files

To make a new directory type "mkdir nameofnewdirectory".

To remove an empty directory type "rmdir directoryname".

To remove a non-empty directory "rm -R directoryname".

To remove a file type "rm filename".

To move a directory or file to a different location within the directory hierarchy type "mv directory(file)name /path/of/new/location/".

Renaming directories and files also uses the mv command. To rename a file or directory you type "mv oldname newname".

Note that there is no "trash can" when working in Linux. When you remove something it is gone. If you are a trigger happy person you may want to get into the habit of using the "-i" option when removing files and directories (i.e. "rm -i filename"). Then you will be asked if you really want to delete the file or directory.

Note that "*" is a wild-card character. For example, to delete all of the contents of a directory you could type (move into the directory first) "rm -R *". If you want to delete only .nexus files, you could type "rm *.nexus".

You can do a considerable amount of file and directory manipulation (deleting and moving files and directories and editing files) from a GUI based sftp program. You may prefer to do this rather than work from the command-line.

Moving around in the directory hierarchy

To change (or "move") into a directory type "cd directoryname". Your current directory is printed at the command-line to the left of the cursor.

To move up one level in the directory hierarchy, you can type "cd ..".

To show the path to the directory that you are currently in (i.e., the present working directory) type "pwd".

To list the contents of your present working directory to the screen type "ls". You can list the contents of a directory other than your present working directory by typing the other directories path after "ls" (e.g., "ls /home/user/other").

The "~" symbol can be used as shorthand for your home directory. For example, imagine that your home directory is /home/pwsd37. If you are deep within the directory hierarchy and want to go to your /home/pwsd37/PAUP directory, simply type "cd ~/PAUP".

To send the output of a command (if it sends output to the screen) to a file type "> filename" after the command. For example, the command "ls > contents" will send the list of directory contents to a file "contents".

Working with files

To print the contents of a file to the screen type "cat filename".

At times you may want to view the last few lines of a huge file. If you use cat to view this file, text may scroll by for a minute or two before you reach the end of the file. To view the last 10 lines of a file type "tail filename". Similarly, you can view the first 10 lines by using "head" instead of tail.

To modify a file from the command-line use the program vi by typing "vi filename". vi is a powerful, albeit awkward at first, program. Go here to learn how to use it.

Miscellaneous

To view the commands available to you on the system in which you are working, press the tab key.

To view previously used commands at the command-line, you can use the up arrow key. This is useful for executing previously entered commands

You may notice that at times the output of a command produces more than a screen full of information and this streams by too quickly for you to view it. To view this output in screen size pieces send the command output to the "less" command by typing "| less" after the command. For example, to view a large file page-by-page type "cat filename | less". Press the space bar to advance to the next screen (page) full.

Many commands ask you for input. If you type something incorrect and try to delete or backspace, you will notice that a string of symbols shows up at the command-line. If this happens, simultaneously press Control (ctrl) and C. You will be returned to the command-line where you can start over by typing the original command again.