UNIX Quick Reference

(or, the only 10 UNIX commands that you really need to know)

You can click on a command name to read its man page. Note: man page links will only work if you are on a computer inside the computer science department.

  1. cd directory
    cd changes the directory you are in to the directory given.
  2. ls [-l] [-a] [filename]
    ls gives you a listing of files and directories. Just typing it on its own will give you a listing within the current directory. You can also type ls mydirectory to get a listing of all the files in the directory mydirectory.
    Options: -l lists all the files with some extra information, such as last modified date and file size. -a lists all files. (Usually files/directories whose names start with a period, such as .project, are not displayed.) Options can be combined, as in ls -la.
  3. cp [-i] [-r] source destination
    mv [-i] [-r] source destination
    cp copies source to destination, while mv moves it. mv also works as a rename command.
    Options: -i turns on interactive mode, which prompts you for confirmation if your copy will overwrite an existing file. -r copies/moves directories recursively; that is, the directory and all its files, including any subdirectories and their files, will be copied/moved.
  4. rm [-i] [-r] filename
    rm removes the given file.
    Options: -i turns on interactive mode, which prompts you for confirmation before removing any files. -r recursively removes a directory, removing any files and subdirectories contained within that directory. Be very careful with the -r option!
  5. mkdir newdirectory
    mkdir creates a new directory with the given name.
  6. more textfile
    more displays the given file. If the file is longer than one screenful of text, more it one screenful at a time. The less command works in the same way.
  7. pico textfile or xemacs textfile
    pico and xemacs are both text editors. pico is faster loading and better for quick edits of small files, while xemacs has many more options and is better for editing bigger files, such as HTML documents and programming code. If textfile doesn't exist, both editors create it for you.
  8. pine
    pine allows you to read and send email.
  9. zwrite username
    zwrite sends a message to the screen of another user.
  10. man commandname
    man is perhaps the single most useful UNIX command. It the manual page for the given command, which usually includes a synopsis of what the command does, all the options you can use with the command, and much more.