Unix Command Quick Reference

The Unix shell is a very powerful command line environment to make operating on your files quick and easy. Below is a list of some of the most commonly used Unix commands. There are plenty of command references on the Internet. Just search for "unix command reference" in your favorite search engine.

For the commands below the '^' refers to the Control key. For example, '^c' reads, "Press Control and the 'c' key simultaneously."

ls List a directory's contents. File and directory names only.
ls -l Long listing of directory contents. Includes permissions and file sizes.
ls -l file1 Long listing of a single file.
du Per-directory disk usage in kB.
du | sort -n Per-directory disk usage in kB, numerically sorted.
quota -v View a summary of your disk usage and your disk quota.
cp file1 file2 Copy file1 to file2. This will overwrite file2 if it exists.
mv file1 file2 Rename file1 to file2. This will overwrite file2 if it exists.
more file1 Display file1 one page at a time. Press <space> for next page.
mkdir dir1 Create a new directory named dir1.
cd dir1 Change your current working directory to dir1.
pwd Show your current working directory.
rmdir dir1 Remove directory dir1. Directory must be empty before removal.
rm file1 Remove file1. No questions asked.
rm -rf dir1 Recursively remove dir1 and all its contents. No questions asked.
gzip file1 Compress file1. This gzip command creates file1.gz and removes the original file1.
Use ls -l file1.gz to see the compressed file size.
gunzip file1.gz Uncompress file1.gz. The gunzip command creates file1 and removes the original file1.gz.
tar czf arc.tgz file1 file2 dir1 Create a gzipped Unix 'tar' archive named arc.tgz containing file1, file2, and all the contents of the directory dir1. The original files are not removed.
tar tzf arc.tgz List the contents of the gzipped Unix 'tar' archive arc.tgz.
tar xzf arc.tgz Extract the contents of the gzipped Unix 'tar' archive arc.tgz. Any existing files will be overwritten by matchine files in the archive.
xprint -d dest file1 Print file1 to a TAMU Open Access Lab specified by 'dest' (bloc, scc). This command is unique to Calclab.
pine Text based mail reader. Very easy to use.
pico Text editor with key bindings similar to pine.
date Show the current date and time.
man cmd View the Unix manual page for cmd. Example: man date.
Arrow Keys The shell stores the commands that you use so you can quickly reuse them. Use the Up and Down arrow keys to go to the previous and next commands. Use the Left and Right arrows within a command to move back and forth.
^p,^n,^f,^b,^a,^e,^L Alternative to arrow keys using control keys.
^p=previous cmd, ^n=next cmd, ^f=cursor forward, ^b=cursor backward, ^a=cursor to start of line, ^e=cursor to end of line, ^L=clear screen
^c or ^\ Interrupt the currently running command.
ps vx View a long listing of your running processes
kill PID Send an INTERRUPT signal to process identified by PID (obtained from the ps command). This should cause the process to exit.
kill -9 PID Send a KILL signal to process identified by PID. The -9 represents the nuclear option, to be used when a process just won't die.
exit (or ^D) Exit from the shell.