Unix Quick Reference
Unix Quick Reference
Command
alias To remove an alias: bg cat cd
Action
Creates a temporary name for a Unix command.
Example
alias name command unalias name
Places a suspended job in the background. Displays a specified file. Changes current directory to a different directory. To change back to your home directory: Directory abbreviations: ~ Home directory .. Parent directory . Current working directory cat file cd directory cd
chmod
Changes permission status for a file or directory. To keep a file private: To give everyone read permission:
chmod code file chmod code directory chmod 600 file chmod 664 file compress file uncompress file.Z cp file1 file2 cp file directory cp -i file1 file2
compress
Reduces the size of a file and adds .Z to the file's name. To restore a compressed file:
cp
Makes a copy of a file. To copy a file into a different directory: To inquire before overwriting an existing file:
diff fg finger
Compares two files and displays the differences. Restarts a suspended job in the foreground. Displays user information at the specified computer. To change your finger entry information: finger userid@computer chfn ftp address grep -icvn pattern file
ftp grep
Starts the file transfer program with a remote computer. Finds lines in a file matching a character pattern. -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. To display the first n number of lines:
help
history
Displays a list of your most recent commands. To repeat the nth command from the list: To repeat your most recent command:
history ! n !! jobs job & fg %number <Control>z bg kill pid kill -9 pid
jobs
Displays active jobs and their corresponding job numbers. To start a job in the background: To return a job to the foreground by the job number: To send a running job to the background:
kill
Terminates a process by its process identification number. To use the strongest form of the kill command:
logout ls
Ends your computer session. Lists the files and subdirectories in your current directory. -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 ls -Fltra
man
Displays Unix Manual entry for a command. To search Manual Index for a keyword or topic:
mkdir more
Creates a new directory within your current directory. Displays a file one screen at a time. Use <Spacebar> to scroll forward and q to quit. Use / to find a string in the file, and n to move to the next occurrence of that string
mv
Moves a file to a different directory. Moves a directory to a second directory. To rename file1 as file2: To rename directory1 as directory2: To inquire before overwriting an existing file:
mv file directory mv directory1 directory2 mv file1 file2 mv directory1 directory2 mv -i file1 file2
passwd ps pwd rm
Starts program to change account password. Displays processes and their corresponding process identification numbers. Displays absolute pathname of current directory. Permanently deletes a file. To verify prior to removal: rm file rm -i file rmdir directory rmdir -i directory telnet address
rmdir
telnet
vi w wc
Starts the vi text editor with a file. Displays a list of who is on system. Counts lines, words, and characters in a file.
vi file
wc file