A Minimal Set of UNIX Commands

The following is a very small but useful subset of UNIX operating system commands. Throughout, fname stands for the name of a file.

exit  Logs you off the system: ALWAYS log off before leaving a lab or any public machine!
man command name   HELP: explains command name (like man rm ).

ls   Lists file names.
ls *fname*   Lists all file names containing the string fname (* is wildcard)
cat fname   Displays fname on screen
less fname   Displays fname on screen, one page at a time. Spacebar for next page, q for quit.
lpr fname   Prints fname on the printer in the computer lab (not your printer at home).
rm fname   Removes fname, erasing it forever.

mkdir dirname   Create subdirectory (like a folder) dirname.
cd dirname   Change directory to subdirectory dirname
cd   Back to main directory
cd ..   Go up a level
pwd   Shows pathway (to current directory).

cp fname1 fname2   Copies fname1 to fname2
cp fname dirname   Makes a copy of fname and puts it in subdirectory dirname
mv fname1 fname2   Moves (renames) fname1 to fname2
mv fname dirname   Moves fname to subdirectory dirname

emacs fname   Starts the EMACS text editor, editing fname (can be new file)
sas fname   Executes SAS commands in fname.sas, yielding fname.log and (if no errors) fname.lst
R   Starts up the R statistical program. (Not on tuzo or river)

ps   Shows active processes.
kill -9 #   Kills process (job) number # : Sometimes you must do this when you can't log off because there are stopped jobs.

curl URL > fname   A URL is a Web address. This command is intended to help you get a copy of the source code of Web pages. But when the web page contains just a data file, as it sometimes does in this course, this is a great way to get a copy of the data. Copy/paste the complete URL from your browser.
mail yourname@yourisp.com < fname   Email a file to yourself. It will come to you in the body of a text-only email message. Very handy for getting files to your home computer for printing, unless you use aa web-based email program like Hotmail or Gmail. In that case, Windows users might try WinSCP. Mac and linux users can use sftp from the command line.


This handout is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.