Unix Cheat Sheet


This page contains a very abbreviated description of some of the most important Unix commands.
cd directory_name changes your current (working) directory to the named directory. cd (cd with no arguments) changes your current directory to be your home directory. logout Logs you out of the system.
ls (ls with no arguments) lists the names of files in your current directory. ls -CF lists the names of the files in your current directory, listing them in multiple columns and appending a '*' to executable files and '/' to directories. ls -l shows a long-form listing which includes a character indicating whether the file is a directory ('d') or an ordinary file ('-'), 9 characters describing the file permissions, the name of the file's owner, the file's size in bytes, when the file was last modified, and the file's name. mkdir directory_name creates a directory with the given name. passwd prompts you for information in order to change your password. pwd displays the name of your current directory on the screen. rm file_name removes (deletes, erases) the named file. pr -f file_name | lpr -Pmsd This command line, a so-called pipeline, can be used to print the named file on the line printer in the lab in Walker Hall room 205. (The line printer is behind the partition; it is not one of the printers at the end of the first double table.) lpq -Pmsd This command line asks the system to display a list of what is in the msd print queue. cat file_name displays the named file on the screen. cp file_1 file_2 copies the content of file_1 to a file named file_2. date prints the current date and time. finger (with no arguments) displays some information about people who are currently logged on. finger user_name displays some information about the named user. finger real_name where real_name is part of some user's real name, should show some information about that user. finger user@internet_address asks the system at internet_address for finger information on user. more file_name
less file_name
These two commands are "pagers". A "pager" is a program that displays a file on your screen a screen-full at a time. If you type a lower case 'h' to either of these programs, you should see a "help screen". mv file_1 file_2 moves file_1 to a file named file_2. mv file_1 file_2 ... directory_name moves the files, file_1, file_2, ..., to the directory directory_name. rmdir directory_name removes the named directory if the directory is empty. If there are files in the named directory, the command will tell you that the directory isn't empty and will not remove the directory. who lists the login name, terminal name, and login time for each current UNIX user.