Basic UNIX Commands

UNIX Help for Users website
 
 
Task Command Description
change password passwd  
make a directory mkdir  NAME  
remove directory rmdir  NAME directory NAME must be empty
change directory cd  NAME  
print working directory pwd  
list files ls -l = long; -a = all; -ltr = long, sort by time, reversed
print to line printer lpr  -P  akira  FILE "akira" is the pair of printers in the lab
remove file rm  NAME -i = interactive ("are you sure?")
rename file mv  OLD  NEW mv = "move"
copy file cp  OLD  NEW -p = preserve date
copy file to another directory cp  OLD  DIRECTORY  
print file to screen cat  FILE cat = "concatenate"
print file to screen slowly more  FILE then SPACE scrolls to next screenful
print lines of a file which contain a word grep  WORD  FILE  
change file permission chmod u = user, g = group, o = other; + = add, - = remove; r = read, w = write, x = execute; 
e.g "chmod go-rwx FILE" removes all permissions from everyone except user
read manual page man  COMMAND do "man man" first!
redirect output to file COMMAND  >  FILE  
read input from file COMMAND  <  FILE  
pipeline commands COM1  |  COM2 first command's output is second command's input
run command in background COMMAND & then command line prompt returns immediately
list background programs jobs  
kill background job #N kill  %N  
complete filename without typing TAB  
command line editing 
(as in emacs)
C-p recall previous command
C-n go to next command
C-f, C-b, C-a, C-e forward, backward, start, end
C-d delete
mount floppy disk volcheck sets up /floppy/floppy0 as usable directory
restore file from backup cd  .snapshot/hourly.0 
cp  OLD  ../..
".snapshot" directory is invisible, but it's there
compile g++  -Wall  -o  OUTPUT INPUT.cxx  
shorthand ~ (tilde) your home directory
~user user's home directory
. (dot) current directory
.. (dot dot) one directory up