Nasty Quick Reference Guide to UNIX

Below are some of the more common UNIX commands. As you get more proficient, you may wish to purchase a book about UNIX.

man keyword the most important command, gets help on keyword which is usually a command. Also try man –k keyword if you do not know the syntax of the command. Play around with these a bit.

cd directory change to directory

cd .. go up one level in the directory tree

cd / go to the root of directory tree

ls list all files in the current directory

ls .* check this out, those files are usually not listed

ls –l to see statistics about your files

rm file remove file

rm * remove all files (go easy on that one)

cp file1 file2 copy file1 to file2 (keeps file1)

mv file1 file2 renames file1 to file2. Can also be used to move files in the directory tree.

mkdir directory make a new subdirectory named directory

rmdir directory remove directory

rm –r directory removes files in and below directory, i.e.even files in its sub (sub…)directories

more file show file, one screen at a time

head file show first 10 lines of file

tail file show last 10 lines of file

chmod 700 file change access privileges. 7 stands for read, write and execute privileges. The first digit sets the rights for yourself, the next one for everyone in your group, the last one for everyone who has access to the computer on which the file is located.

passwd to change your password

grep string * searches all files in the current directory for occurrences of string

printa file print file to printer lj119anp

printb file print file to printer lj119bnp

showa see what’s in the queue of printer lj119anp

showb see what’s in the queue of printer lj119bnp

lpr –Pprintque file print file to printque. No space between P and printque.

telnet machine start remote session to machine

ftp machine if you want to transfer files between machines

get filename when in FTP, used to copy a file FROM a remote machine

put filename when in FTP, used to copy a file TO a remote machine

logout logout