Commands for the UNIX operating system are case sensitive. UNIX commands are typically lower case. There can be up to three parts for each command i.e. command [options] arguments. Below are some common UNIX commands with descriptions and examples.
UNIX Command |
Description of UNIX Command |
Example of UNIX Command |
File Commands | ||
cat | Concatenates a file. | cat filename |
cp | Copy a file. | cp oldfilename newfilename |
chgrp | Change root of directory or file. | chgrp root filename |
chown | Change ownership of director or file. | chown admin filename |
chmod | Set permissions on directory or file. | chmod 755 filename |
date | Displays current day, date and time. | date |
diff | Displays the difference between two text files. | diff filename1 filename2 |
file | Display file type. | file filename |
less | Displays the file with minimal space. | less filename |
Read and send email messages. | ||
more | Displays the contents of a file with page breaks. | more filename |
mv | Rename a file or directory or move a file to another directory. | mv oldfilename newfilename mv /etc/filename /usr/filename |
pico | A basic text editor. | pico pico filename |
pine | Read and send email messages. Has more features than mail. | pine |
ps | Reports the status of the currently running processes. | ps ps options |
pwd | Displays current directory path. | pwd |
quota -v | Displays current disk usage and limits. | quota -v |
rm | Remove (delete) a file. | rm filename |
sort | Sort the lines of a text file alphabetically. | sort filename |
vi | Text editor. | vi vi filename |
w | Indicates who is currently logged in with more information than "who." | w |
wc | Counts the number of lines | wc filenames |
who | Indicates who is currently logged in. | who |
./ | Execute a program from the command line. | ./filename |
* | Wildcard. | rm abc*.pl (This will delete all files starting with abc and ending with .pl) |
Directory Commands | ||
pwd | Displays current directory path. | pwd |
echo $cwd | Displays the logical path or directory. | echo $cwd |
cd | Change directory. | cd /usr/ |
cd .. | Go back one directory level. | cd .. |
ls | Lists the contents of the current directory. | ls -a |
mkdir | Make a directory. | mkdir directory-name |
rmdir | Remove a directory. | rmdir directory-name |
General Commands | ||
passwd | Allows you to change your password. | passwd |
logout | Ends your current session. | logout |
ps | Displays current processes. | ps |
clear | Clears the terminal screen. | clear |
quota -v | Display disk usage. | quota -v |
gzip | Compresses a file. | gzip filename |
gunzip | Uncompresses a file. | gunzip filename |
Help Commands | ||
apropos | Commands for a specific topic. | apropos mail |
help | A list of online help topics or help on a specific topic. | help help mail |
man | A list of manuals or a manual on a specific command. | man man mail |
whatis | A description of a specific command. | whatis mail |
Print Commands | ||
lpr | Prints a postscript file. | lpr filename |
enscript | Prints text files to a postscript printer. | enscript -Pprintername filename |
printers | Displays a list of printers and locations. | printers |
lpq | Prints the current print queue. | lpq -Pprintername |
lprm | Removes a print job from queue. | lprm -Pprintername queuenumber |