Cheat Sheet Directory Manipulation Creating Directories % directory Setup Changing Directories % directory Terminal Setup % stty erase ‘^?’ ‘^U’ intr ‘^C’ % cd % set term=vt100 Displaying Current % Setting Path Variable % set =(directory ... directory) Directory Password Changing % Removing Directories % directory Changing Default % Shell Miscellaneous Commands % man command % man -k topic Finding Files % directory -name filename -print Logging Out % logout Searching Files % string filename % Sorting Files % [-o output-] filename Comparing Files % filename1 filename2 File Manipulation % filename1 filename2

Listing Files % Displaying Files % filename File Protection % filename u file owner (u is short for user) next page User and Permission g group members next line Types o all other users q quit r Copying Files % file1 file2 read permission % cp file1 [file2] ... directory permission % cp -r directory1 directory2 x execute permission (for directories, allows users to use the directory name in a pathname) Use the -i option to prompt before overwriting files. Displaying File % ls -l filename Moving Files % file1 file2 Protection % mv file1 [file2] ... directory Changing File % [ugo][+-=][rwx] filename % mv directory1 directory2 Protection % chmod nnn filename Use the -i option to prompt before overwriting files. numeric protection mode table % filename Removing Files user group other % rm -r directory r 400 40 4 Use the -i option to prompt before deleting files. w 200 20 2 x 100 10 1 Printing Files % lpr filename Default Protection % nnn The umask value is subtracted from 666 for new files and from 777 for new directories. I/O Special Files Input Redirection % command < filename .cshrc This file, if it exists in your , is automatically % command > filename Output Redirection executed login. Must begin with “#” to indicate (overwrite) . % command >> filename Output Redirection .cshrc typically includes C shell specific commands such (append) as the set noclobber, set , set savehist, Error Redirection % command >& filename and commands. (overwrite) .login This file, if it exists in your home directory, is automatically # Error Redirection % command >>& filename executed at login. Must begin with “ ” to indicate C shell (append) script. .login Noclobber Variable % set noclobber typically contains generic UNIX commands such as the stty, set path, and umask commands. Setting the noclobber variable protects files from being .logout This file, if it exists in your home directory, is automatically accidentally overwritten due to output redirection (but not executed at logout. Must begin with “#” to indicate C shell cp, mv, etc.). “!” following any redirection operator over- script. rides noclobber. .logout Piping Operator % command1 | command2 typically contains commands to perform cleanup.

C Shell Specific Commands % command & Enable Tracking of % set history=n Running Jobs in the Commands Background % command Displaying Com- % history Stopping Foreground Jobs . mand History . Re-executing Previ- !! previous command . ous Commands !nnth command !string last command beginning with string % !-nnth recent command Job Status % jobs !?string? last command containing string % kill %job-number % set savehist=n Killing Jobs Saving Command % kill -id History Bringing Jobs to the % fg %job-number Setting Aliases % alias alias-string command-string Foreground % alias Displaying Aliases Moving Jobs to the % bg %job-number Deleting Aliases % unalias alias-string Status % lists all your processes % ps -a lists all running processes % ps -x full listing for given option Displaying Users % %