Unix Reference Card

This reference card contains the basic commands necessary to navigate around the Unix file system. There are many more commands representing many programs. Each program here will have several options that may be typed after the program name in order to make the program perform different tasks. If you ever need more information about a command, type:

% man programname

where the % sign is your command line prompt (it should already exist and doesn't need to be typed), man is short for the manual program in Unix, and programname is the name of the program/command that you need more information about.

In the following table, the different formats you see will represent:

You must hit a return after typing in a command and commands, arguments, and optional arguments normally need to be separated by spaces. Unlike some other operating systems, the case (upper or lower) matters in Unix, so a file with the name Snoopy.txt is a different file from snoopy.txt

Name Description Example
cat filename1 Display the contents of filename. This command may accept multiple filename arguments in which case it will concatenate the files in the order or the filename arguments and display them all at once. cat withTheWildNose.txt
cat withTheWildNose.txt eatsBugs.txt
cd +directory-name+ Change from your current directory into another one. If you type the command with no arguments you will go to your home directory, If you type a . as a directory-name, then the program will stay in the current directory, and if you type .. as the directory name, then the program will change directories to the directory above the current one in the directory tree. cd ..
cd finickyFolder
cd
cp filename1 filename2 Copies the contents of filename1 to a file with the name filename2. This command will overwrite filename2 if it already exists. cp sillyCats.txt catsWhoSlideAcrossFloors.txt
date Used to give the date date
du +directoryName+ Display disk usage du
findhog This is an RIT script used to find the biggest files in your directory/account. Very useful if you are over quota and don't know what to delete. findhog
less filename Displays filename one screenful at a time. Similar to the more command. less heavenlyChocolate
lp fileName Prints a file to the default printer. If you want to print to a specific printer then type: lp -d printername fileName lp -d csl_lw2 luckyMe.txt
ls +directoryname+ Without the optional argument, ls gives a listing of the files and directories in the current directory. With the optional directory name, ls will give a file/directory listing of the information from that particular directory. ls is commonly used with the following options.

ls -a List all (even hidden or dot files) ls -l Give a long listing display
ls -a ls jellyBeanFlavors ls /etc/hosts
mkdir directory-name Makes a directory or folder with the name directory-name mkdir answersInTheUniverse
more Displays information one screenful at a time. more bitsPerGallon.txt
mv old-name new-name Moves or renames old-name to new-name. If old-name is a directory, then mv moves old-name into new-name. mv snoopy.txt snoopyBird.txt
mv cs/lab1 cs/labs/lab1
pwd Display (Print out) the current (Working) Directory. pwd
rmdir directory-name Removes a directory/folder if it has no contents underneath it. rmdir ickyPooDirectory
rm name1 name2 For files, rm removes them in the order specified on the command line. There may be several files that are removed at once. When given as the following:

rm -r directory-name

rm will remove directory-name recursively, removing all files and sub-folders underneath directory-name. Be careful with this command as it is difficult (if not impossible) to get folder contents back if you accidentally erase important folders in your account. If you accidentally erase a lab, make sure to contact your instructor immediately. It may be possible to get archival copies from a backup disk if the files/folders aren't new.
rm -r lotsOfFishyFiles
rm -r files/ofFishynessFolder
ssh hostname OpenSSH Secure shell that allows you to login to other machines remotely. Can also be done as: ssh username@hostname ssh snoopy@queeg.cs.rit.edu
top Show continuously what processes/programs are currently taking up the majority of processing time on a machine. Very helpful if you notice your machine is being very slow. You can hold down control and type c (ctrl-c) in order to exit this program. top

Prof. Bayliss August 10, 2004 at 3:30 PM