Basic UNIX Commands
Command |
Description |
*, ? |
Many commands allow wild card characters in the file names. An * (asterisk) stands for any string of 0 or more characters, and a ? (question mark) stands for any single character. For example, *.c means all files that end with .c and pr1.* means all files that start pr1. If you use * alone, it means all files (which is different from MS-DOS). |
cat file |
Copy a file to standard output (can be used as a filter) e. g. "% cat pr1.c" will display the file pr1.c on your screen. |
cd pathname |
Change directory e. g. "% cd ~wes" will change to my home directory. |
chmod |
Change file permission mode (wild cards OK) |
cp file target |
Copy file(s) (wild cards ok) If target is a directory, file(s) are copied to that directory with same name. If target is a name, file copied with that as name of copy e. g. "% cp /home/3/wes/ics211/* ." will copy all the files from the directory wes~/ics211 to your default directory. ("." is an abbreviation for the directory where you are, ".." for your parent directory.) Note that the cp command always needs both a source and a destination operand. |
date |
Display date |
diff file1 file2 |
Compare two text files and display where they differ |
du |
Display disk usage |
man command |
Display on-line manual for command. For example, "% man ls" will display a short manual on the "ls" command. |
ls [-l] [-a] directory |
Lists contents of directory. Including the option -l gives more detail (protection, size, and date) -a causes ls to include files whose name starts with a period--they are not normally listed (wild cards OK) e. g. "ls ics211" lists all the files in the directory called ics211. "ls -a -l" lists all the files in your current directory, including files whose names start with . and this gives many details about the files. (Files whose names start with . are "hidden" files.) |
mkdir pathname |
Make a new directory e. g. "% mkdir pr2" makes a directory called pr2 |
more |
Display file in controlled increments e. g."% cat pr1.c | more" displays pr1.c in one page increments. ( "|" is a "pipe"--we will discuss pipes a little later.) Hit return to get the next page. |
mv name1 name2 |
Rename file name1 to name2 |
passwd |
Change your login password |
pwd |
Print working directory (your current directory) |
rm file |
Remove (delete, erase) a file or files (wild cards OK) |
rmdir pathname |
Remove a directory |
repeat a command |
To recall and re-execute previous commands, use the up-arrow key. Keep pressing this key until you find the command you want to reuse, then press the return/enter key. Note that you need to be in the "tcsh" shell for this to work. This is done by simply typing "tcsh" at the command line. "tcsh" stands for Tenex-C-shell. |
(web tutorials) |
For more information on scripts and other UNIX shortcuts, see The C Shell Tutorial. See also ITS Documents for useful information on UH UNIX and many other related topics. |
(textbooks) |
Just Enough UNIX, 5th Edition, Paul K. Andersen, McGraw-Hill, 2005 (ISBN 0072952970). |
(history) |
Believe it or not, UNIX has its origins in a videogame called "Space Travel". See the Wikipedia for details. |
Notes by Dr. Wes Peterson and William Albritton