Unix commands reference card

Abbreviations used

C-x hold down control key and press x

cmd a unix command such as ls, cd, etc

d directory

f filename

n number

[ ] optional argument

Caution

1 the number 1 (read carefully)

l the letter l (read carefully)

Unix Command Description

man Unix online help (man ls, man cd, man cat, etc)

cat f List contents of file

more f List file contents by screen

cat f1 f2 > f3 Concatenates f1 & f2 into f3

ls [d] List files in directory

ls -l [d] (ls –a) (ls > f) List files in detail (list all files) (capture listing in file f )

cp f1 f2 (cp f1 d) (cp d1 d2) Copy file f1 into f2 (or f1 into directory d) (or d1 into d2)

mv f1 f2 (mv f1 d) (mv d1 d2) Rename file f1 as f2 (or move f1 into directory d) (or d1 into d2)

rm f Delete (remove) file f

mkdir d Create new directory d

rmdir d Remove directory d --must be empty

pwd Print working directory-- where you are

cd d Change to directory d (cd - go to last directory)

cd .. go up one directory

C-c Interrupt processes

C-s Stop screen scrolling

C-q Resume screen output

exit Exit (the proper way to log out of Unix--may need to repeat 2x

history Display recent commands

! n Redo recent command n

grep 'ptn' f Outputs lines that match ptn

diff f1 f2 Lists file differences

head f Output beginning of f

tail f Output end of f

g++ f.cpp -o f compile program f.cpp into executable f

PICO EDITOR

pico [f] Open pico editor [on optional file f]

C-g Get help when you are in pico

C-x Exit

C-o ??? Save file

C-k cut text

C-u un cut text