In the table on the next page a variety of the most important Unix commands are listed with their common usage and a brief description. This is intended only as a quick reference; check the man pages for more details. Entries in italics are built-in shell commands (csh) and entries underlined are used most frequently in scripts. Square brackets [ ] indicate optional arguments. An ellipsis ... indicates multiple arguments of the given type are supported. Note that the syntax for arguments varies between commands (e.g. whether you can use -al in place of -a -l); unfortunately only the man page can tell you for sure.
Command with Common Usage | Description |
---|---|
alias [ name [ string ] ] | Make name an alias for string |
awk script [ file ] | See description below |
basename [ path ] | Return everything after last / in path |
bg [ %job-id ] | Put job in the background |
break | Escape from control loop |
cat [ file ... ] | Concatenate and display files |
cd [ dir ] | Change working directory |
chmod mode file | Change permissions mode of file |
continue | Continue next iteration of control loop |
cp source target | Copy source file to target file |
diff file1 file2 | Display differences between file1 and file2 |
dirname [ path ] | Return everything before last / in path |
echo [ -n ] string | Write string to standard output |
exit [ value ] | Exit from current shell with optional return value |
fg [ %job-id ] | Return job to foreground |
foreach word ( list ) [ ... ] end | Succesively set word to elements in list |
grep [ -i ] pattern [ file ] | Search for pattern in file |
head [ -number ] [ file ] | Print first few lines of file |
hostname | Print name of current host |
if ( expr ) [ then ... else ... endif ] | Conditional evaluation (else if also supported) |
kill [ -signal ] pid | Terminate or signal a process |
ln -s source [ target ] | Make symbolic link from target to source |
ls [ -alrt ] | List contents of directory |
make | Maintain and regenerate related programs and files |
man [ -k ] command | Display man page for a command or keyword |
mkdir dir | Make directory |
more [ file ... ] | Browse or page through a text file |
mv source target | Move or rename source to target |
nice [ -priority ] command | Execute command with specific priority |
ps | Print information about active processes |
pwd | Return working directory name |
rehash | Refresh command search path |
renice priority pid | Change process priority |
rm file | Remove file |
rmdir dir | Remove directory |
sed script [ file ] | See description below |
set [ variable [ = value ] ] | Set shell variable to value (opposite unset) |
setenv [ VARIABLE [ word ] ] | Set environment variable to word (opposite unsetenv) |
sort [ file ] | Sort lines of text file |
source file | Execute commands from text file |
switch ( expr ) case: [ ... ] endsw | Choose from among a list of actions (like in C) |
tail [ -number ] [ file ] | Print last few lines of file |
tee [ file ] | Replicate standard output |
time command | Time a command |
top | Display information about top CPU processes |
touch file | Create empty file or update access & mod times |
uptime | Show system load and how long system has been up |
w | Display information about logged-in users |
wc [ file ... ] | Count lines, characters, and bytes in file |
whatis command | Display summary about a command |
which command (also where command) | Locate a command; display its pathname or alias |
while ( expr ) [ ... ] end | Loop while expr true |