UNIX Commands (Remember: RTFMP) Command Purpose alias Creates an alias for a command awk Start the awk program to select and format output cal Show the system calendar cat Create or display or concatenate files cd Change directories chmod Set file or directory permissions clear Clear the screen (terminal window) comm Compare two files, output common lines cp Copy a file cut Extract specified columns or fields from a file date Display the system date and time df Report information about file systems diff Compare two files, output lines that differ du Report disk usage of current/subdirectories echo Copy to stdout exit Exit UNIX (also CTRL-D) export Makes a local variable an environment variable find Search in a directory and all its subdirectories gawk Gnu awk—see awk grep Search for a string of characters in a text file head Display the first few lines of a file kill terminate one or more process ids less Display a long file one screen at a time, scroll up & down logout Exit UNIX (also CTRL-D) lpr Print files ls Display directory contents mail Send email from the command line or read mail man Display the online manual for a command mkdir Make a new directory more Display a long file one screen at a time, scroll down mount Connect filesystems to a directory tree mount point mv Move/rename files nawk New awk—see awk passwd Change password paste Combine fields from two or more files pr Format a file for printing to stdout printenv Prints a list of environment variables to stdout (see set) pwd Print working (current) directory rm Remove (delete) file rmdir Remove an empty directory sed Apply editor commands to a (usually large) file set Set environment variables or print to stdout (see printenv) set -o noclobber Prevents files from being overwritten by ">" sh Execute a shell script sleep Wait for a specified number of seconds sort Sort a file tail Display the last few lines of a file tee Accept stdin and send it to both stdout and a file touch Update an existing file’s date/time stamp or create empty file tr Translate characters trap Executes a command on receipt of a signal from UNIX umount Disconnect filesystems from a directory tree mount point unique Remove adjacent duplicate lines vi Start the vi editor wc Count the number of lines, words, or bytes in a file whatis Display a brief description of a command who See who is logged in xargs Execute a command on multiple strings from stdin The Channels of a UNIX Command: stdin (0) -> command -> stdout (1) and stderr (2) The standard out of one command can be piped ( | ) into standard in of another command. For example: ls -al | grep joe lists all the files in the current directory and searches for the string "joe" in the filenames and only prints those that match.. ls | xargs -i grep joe {} searches for the string "joe" within the body of all files in the current directory, illustrating the use of pipe and the xargs command. find . –size +100000c –print > big1s 2>&1 Finds all files in this and subordinate directories that are larger than 100,000 bytes, sending both stdout and stderr to file "big1s".