3.6 Unix Command Reference

This is a summary of the few most useful commands in Unix. It is not a complete reference. To see full details on each command, read the corresponding online manual page.

Arguments are displayed like this, This is to remind you that you must not type the argument text literally as it appears here, but replace it with something sensible. For example, pathname should always be replaced with the pathname of a file or directory.

In addition, optional arguments have square brackets around them, [like this], and an argument of the form filename... denotes a list of one or more arguments of the same type.

Most commands have optional flags, which are detailed fully in the manual page. For example, ls has an optional flag -F ("indicate file type") to make it display a special character after each file it lists indicating whether the file is a directory, an executable file, etc. This could be used like this:

ls -F mydir

Always remember that in Unix, case is significant, so LS is not a Unix command, while ls is.

cd [pathname]
If pathname names a valid directory, then cd ("Change Directory") makes it the new current directory for your shell. Without an argument, cd changes to your home directory.
ls [pathname...]
If pathname names a valid directory, then ls displays a listing of it. Without an argument, ls displays the current directory.
man [section-number] topic
The man command lets you read the online Unix manual page corresponding to the given topic. Usually topic is just a command name. For example,
	man man
presents the manual page about the man command itself. The section-number is not usually necessary, but it can be used to distinguish pages with the same name in different sections. For example, section 1 is for user commands, while section 5 describes Unix file formats. If you're running X Windows, you may prefer xman.
mv filename [filename...] directory
mv filename new-filename
The mv command has two forms. In the first form, all the named files are moved to the named directory, retaining the same filenames.

In the second form, the file filename is renamed to new-filename. Note that if new-filename already exists and is a directory, mv will simply move the file into the directory instead, since this is indistinguishable from the first form of mv.

In both cases, any files in the target directory with the same name can be overwritten, although mv will ask first, unless you disable this feature in your startup files.

pwd displays the name of the shell's current directory.
rm filename [filename...]
The rm command removes all of the named files. There is no way to recover a file deleted in this way. rm will ask for confirmation before deleting each file, unless you have changed your startup files to indicate otherwise. Use rm -r (with caution!) to recursively delete a directory and all of its subdirectories. It is safer to use rmdir to remove a directory.
rmdir directory-name
The rmdir command removes the named directory, so long as it is empty and the user has permission to do so.
This X Windows command starts a small window from which you can search the online Unix manual. It is the same manual as presented by the man command, but the user interface is nicer. You may already have xman running when you log in. If not, read Customizing X Windows .

Keith Orpen, who is still writing this, would like to hear your comments and suggestions.