SIMPLE UNIX COMMANDS 1) File and Directory Manipulation cat f1 :PRINT the contents of the file "f1" on the screen cd d1 :CHANGE DIRECTORY to "d1" (make "d1" your CURRENT DIRECTORY) cp f1 f2 :COPY file "f1" to file "f2" diff f1 f2 :PRINT the DIFFERENCES between files "f1" and "f2" file fname :describe what kind of file FNAME is grep pat f1 :PRINT all lines in f1 which have the pattern "pat" on them. head -n f1 :PRINT the first n lines of "f1" on the screen ls :LIST contents of the current working directory mkdir d1 :CREATE the directory d1 more f1 :PRINT the contents of file "f1" a screenful at a time mv f1 f2 :MOVE file "f1" to file "f2" (i.e. RENAME file "f1" "f2") pwd :print the CURRENT DIRECTORY rm f1 f2 f3 :REMOVE files f1, f2, and f3. rmdir d1 :REMOVE the directory d1 tail -n f1 :PRINT the last n lines of "f1" on the screen vi f1 :EDIT file "f1" (CREATES "f1" if it does not exist) 2) Compiling programs f77 -o p1 p1.f :compile the FORTRAN file "p1.f" and put the output in "p1" cc -o p1 p1.c :compile the C file "p1.c" and put the output in "p1" error :interpret COMPILER ERRORS and put them in the source file make :a program which makes it easy to COMPILE programs p1 :RUN the program p1 which you just compiled via f77 or cc. 3) Keeping Track of Disk Usage df :tell how much disk space is left on the computer du :tell how much disk space is being used by the current working directory du dirname :tell how much disk space is being used by the directory "dirname" 4) Keeping Track of Jobs; Job Control ps :PRINT all the PROCESSES you have running jobs :PRINT all the JOBS you have running :suspend the current job bg :put the most recently suspended job in background command & :the & means to run the job in background and frees the terminal so you can go on to something else while the job is running. fg :bring a job into the foreground %2 :bring job number 2 to foreground (2 is the number next to the job when you use the "jobs" command. kill %3 :kill job number 2 kill 2365 :kill process number 2356. (2356 is the number next to the process when you use the "ps" command. Communicating with Other Users mail ralph :send mail to the user whose login name is ralph write ralph :write a message to the user whose login name is ralph Logging on and Off login :This is the login prompt. First type your user name, then your password. logout :log out of the system. passwd :change your password Printing Files to the Line Printer lpr filename :send the file "filename" to the line printer print filename :send the file "filename" to the line printer with a header cancel :cancel a line printer job Getting Documentation apropos word :PRINT an INDEX of all programs which pertain to "word" man -k word :same as apropos man progname :PRINT the MANUAL ENTRY for the program named "progname" Clearing the Screen clear :clear the terminal screen but not the graphics Machine to Machine File Transfer and Communications kermit :KERMIT intra-machine FILE TRANSFER program ftp :network file transfer program rsh :remote shell on another computer rlogin :log in to a remote computer telnet :log in to a remote computer Command Interpreters and Environment csh :the C shell sh :the Borne shell ksh :the Korn shell tset :set terminal capabilities stty :set terminal parameters Miscellaneous remind :print daily reminder memos CONCEPTS directory structure file permissions shell environments shell scripts environment variables pipes/redirects standard input, standard output, standard error