Command Action Example


cat Displays a specified file.
cat file

cd Changes current directory to a different directory.
cd directory
To change back to your home directory: cd
Directory abbreviations:
~ Home directory
.. Parent directory
. Current working directory

chmod Changes permission status for a file or directory.
chmod code file
chmod code directory
To keep a file private: chmod 600 file
To give everyone read permission: chmod 664 file

compress Reduces the size of a file and adds .Z to the file's name. compress file
To restore a compressed file: uncompress file.Z

cp Makes a copy of a file.
cp file1 file2
To copy a file into a different directory: cp file directory
To inquire before overwriting an existing file: cp -i file1 file2

diff Compares two files and displays the differences.

date Shows the current date and time
date

finger Displays user information at the specified computer.
finger userid@computer

ftp Starts the file transfer program with a remote computer. ftp address

grep Finds lines in a file matching a character pattern.
grep -icvn pattern file
-i Ignores case
-c Lists count of lines that contain pattern
-v Lists all lines except those with pattern
-n Lists line number for each found pattern

head Displays the first ten lines of a file.
head file
To display the first n number of lines: head -n file

help Displays an online help note.
help note
To display a list of help notes: help -l

history Displays a list of your most recent commands.
history
To repeat the nth command from the list: ! n
To repeat your most recent command: !!

hostname Shows the name of the current host
hostname

jobs Displays active jobs and their corresponding job numbers.
jobs
To start a job in the background: job &
To return a job to the foreground by the job number: fg %number
To send a running job to the background: <Control>z bg

kill Terminates a process by its process identification number.
kill pid
To use the strongest form of the kill command: kill -9 pid

logout Ends your computer session.

ls Lists the files and subdirectories in your current directory. ls -Fltra
-l Lists long format
-t Lists by modification time
-r Lists in reverse order
-F Lists file type with special character
-a Lists all files including dot (.) files

man Displays Unix Manual entry for a command. man command
To search Manual Index for a keyword or topic: man -k keyword


mkdir Creates a new directory within your current directory.
mkdir directory

more Displays a file one screen at a time.
more file
Use <Spacebar> to scroll forward and q to quit.

mv Moves a file to a different directory.
mv file directory
Moves a directory to a second directory. mv directory1 directory2
To rename file1 as file2: mv file1 file2
To rename directory1 as directory2: mv directory1 directory2
To inquire before overwriting an existing file: mv -i file1 file2

passwd Starts program to change account password.

ps Displays processes and their corresponding process identification numbers.

pwd Displays absolute pathname of current directory.

rm Permanently deletes a file.
rm file
To verify prior to removal: rm -i file

rmdir Deletes an empty directory.
rmdir directory
To verify prior to removal: rmdir -i directory

uname shows the vesion of the Currnt OS
uname
uname -a : Display complete version information

vi Starts the vi text editor with a file.
vi file

wc Counts lines, words, and characters in a file. wc file