UNIX COMMANDS (from many sources) TERMS ----- Home Directory: The directory assigned to your account. When you log in, you are in this directory. Login ID: Your name or initials, used to identify yourself to the login prompt. Also called "user ID" or UID. Pathname: The address of a file or directory on the file system. An ABSOLUTE or full pathname specifies how to get there from the root directory. A RELATIVE pathname specifies how to get there from the current working directory. Pipe: A pipe sends the output of one command on to become the input of the next command. Often used with a FILTER to modify or limit output. Process: A program that is being executed by the computer. PID is the ID number assigned to each process. Shell: The shell interprets commands before presenting them to the operating system for execution. There are different shells available; two of the most popular are the Bourne shell and the C-shell. Working Directory: Your current directory or location on the file system. SOME COMMON COMMANDS -------------------- Environment control cd d change to directory d mkdir d create new directory d rmdir d remove directory d (d must be empty) mv f d move file f to directory d mv d1 d2 rename d1 as d2 (file or directory) passwd change password alias S1 S2 let string S1 stand for S2 in shell commands File Manipulation vi f edit file f with vi editor cat f print contents of file f more f print contents of file f in screen-sized blocks less f print contents of file f in screen-sized blocks cat f1 f2 > f3 catenate copies of f1 and f2 and call the result f3 chmod change file protection modes cp f1 f2 copy file f1 into f2 mv f1 f2 rename file f1 as f2 rm f remove file f grep p f outputs lines in file f that contain pattern p diff f1 f2 outputs differences between file f1 and file f2 head f outputs beginning lines of file f tail f outputs last lines of file f Environment Status wc f outputs line, word, and character count for file f ls list files in current working directory ls -l list files with protection modes and sizes ls d list files in directory d who list users logged in pwd print working directory date print date and time ps list background processes and process status alias list aliases help give list of help topics man c give UNIX Programmer's Manual entry for command c printenv give values for environment variables (TERM, USER, etc.) history list commands executed during current login session Process Control ^Z suspend current process c & run command c in background kill n remove process n (where n is a number) from background (get this number from ps command) ^S stop output ^Q resume output SPECIAL SYMBOLS --------------- Symbol Description ------ ----------- | To set up a pipe > To redirect output to a file >& To redirect all output, even error messages, to a file < To redirect input from a file >> To append output to an existing file / Separator used in pathnames & To process command in the background * To match any number of characters in filename ? To match any single character in filename [] To match any one of the enclosed characters in filename Examples for use of special symbols: ls -l | more List files with protection modes and sizes, in screen-sized blocks. c >& f & Execute process c, redirecting all output to file f, and do it in the background. ls bob* List all files starting with bob. This will list all the following filenames: "bob bob27 boba bobbin_98 bobV bobby" . ls bob? List all files with four letter names starting with bob. In the above example, it will list only "boba bobV" . ls bob[a-z]* List all files with at least four letter names starting with bob and a letter between a and z. Thus it will list only "bobby boba bobbin_98" from the above example. (bobV is not listed because capital and lowercase letters are distinct in the unix environment.)