Unix for New Users
If the Unix operating system is new to you, there are certain commands and characters it is useful to know about since they are used on a regular basis. You should be aware that the entire "Unix User's Manual Reference Guide" to commands is available for viewing online. So, for detailed information about any of the commands described below, as well as all other Unix commands, at the Unix prompt you can enter
Where commandname is the name of the command about which you wish information.
Remember, UNIX COMMANDS ARE CASE SENSITIVE!
Commonly Used Unix Commands
cat - concatenates files and displays them on your screen more - displays named file(s), pausing for each page to be read ex - invoke basic Unix line text editor vi - invoke full screen-oriented version of ex finger - user information lookup program ls - list contents of directory mail - send and receive mail msgs - system messages and junk mail program passwd - change login password ts, tset - set terminal modes; use ts, it is a useful alias who - who is on the system
Special Unix Characters
DELETE Backspace over and erase the last character typed in. ^C Interrupt the current program. ^U Kill current line and start over. ^S Pause while printing something. ^Q Continue after pause. ^R Retype the current line. ^W Erase last word typed in. ^Z Suspend job (resume via `fg' -
Viewing a File
"More"-ing: Some programs (such as help and man) use a mechanism called "more" to write long files onto your terminal. If you enter the command
a page of the file `filename' will appear on your terminal, followed by:
To continue displaying the file, press `d' or the space bar. To stop, type `q' or press ^C.
Commands to Get Information
man yyyy Show UNIX Programmer's Manual entry on topic `yyyy' apropos keyword Lists commands relevant to keyword. msgs Read system messages msgs 95 Read system messages starting at number 95. msgs -3 Read last 3 system messages
ls List files in the current directory. ls -al Long list of all files in current directory. (this list includes files whose names begin with `.') cat f1 f2 ... Print the files `f1', `f2', ... on the terminal. more f1 f2 ... Print the files `f1', `f2', ... on the terminal, one screenful at a time. cp f1 f2 Copy file `f1' to file `f2' ln f1 f2 Link file `f1' to the alias name `f2' (note that ln provides two names for the same file, whereas cp makes a separate copy of the file). mv f1 f2 Move (that is, rename) file `f1' to new name `f2'. rm f1 f2 ... Remove (that is, delete) files `f1', `f2', ...
pwd Give full pathname of current directory. cd d1 Change to directory `d1' mkdir d1 d2 ... Make new directories called `d1', `d2', ... rmdir d1 d2 ... Remove directories `d1', `d2', ... the directories can be removed only if they are empty (use `rm' to remove the files first) ls d1 d2 ... List files in directories `d1', `d2', ...
Special Shell Characters: < > >> | &
a.out < f1 Program `a.out' reads from file `f1' instead of terminal a.out > f2 Program `a.out' writes to `f2' instead of the terminal. a.out >> f `a.out' appends to file `f' instead of overwriting it. a.out <f1 >f2 These may be combined; spaces don't matter. a.out | b.out The output of `a.out' is the input for `b.out' a.out & run `a.out' in background a <f | b >g & Another possible combination.