The University of Arizona

Resources

UNIX Reference Sheet

February 15, 1991

NOTES OF INTEREST

If you type any letter of your username in uppercase, the UNIX system assumes that you are using a terminal that only has uppercase letters.

Separate multiple commands on a single line with a semicolon.

Files starting with a "." may be hidden from the ls command.

UNIX commands allow the use of wild-characters or meta-characters. The list of wild-characters that UNIX understands are:

       *        -  any arbitrary character string
       ?        -  any single character
       []       - any single character within the []
       [a-z]    - range of characters

COMMANDS


apropos <keyword>                  - locate commands by <keyword>
at time  <commandfile>             - execute <commandfile> at [time]
at time [day] <commandfile>        - execute <commandfile> at [time] and [day]
cat <file>                         - display <file>
cat <file1> <file2>  > <file3>     - <file3> contains <file1> <file2> concatenated
cc <file>.c                        - UNIX C Compiler - compiles <file>.c
cc -g <file>.c                     - produce additional symbol table info for use by dbx
cc -o <outfile> <file>.c           - output file is named <outfile> instead of a.out
cd                                 - change working directory to home directory
cd <pathname>                      - change working directory to <pathname> directory
chmod                              - changes the mode of a file or directory
comm <file1> <file2>               - display lines in <file1> <file2> lines in common
comm [1] [2] [3] <file1> <file2>   - suppresses printing of [1] [2] [3] column
cmp file1 file2                    - compare two files
cmp [-l] file1 file2               - compare files and how they differ.
cmp [-s] file1 file2               - compare files but only return codes.
cp <file1> <file2>                 - copies <file1> to <file2>
cp -i <file1> <file2>              - if <file2> exists, will ask if wish to overwrite it
date                               - display current date and time
date -u                            - display current date and time in GMT (universal) time
dbx                                - debugger
diff <file1> <file2>               - display differences between <file1> <file2>
file <file>                        - tries to determine type of file
grep <string> <file>         - search for <string> in <file>
grep -c <string> <file>      - count of matching lines
grep -n <string> <file>      - display line number where match occurred
grep -i <string> <file>      - ignore case of <string>
grep -x <string> <file>      - lines matching in entirety are displayed
head <file>                  - display first 10 lines of <file>
head -[#] <file>             - display first [#] lines of <file>
kill <processid>             - terminate a <processid>
learn (1)                    - computer aided instruction about UNIX
lint <file>.c                - C program verifier  -  verifies <file>.c
lpq                          - display printer queue
lpr <file>                   - send <file> to line printer
lpr -p <file>                - format <file> before sending to line printer
lpr -l <file>                - allow control characters to be printed
lpr -m <file>                - send mail after <file> printed
lpr -i <file>                - printed lines are indent 8 spaces
lpr -i [#] <file>            - printed lines are indented [#] spaces
lprm [#]                     - remove job [#] from printer queue
lprm -                       - remove all jobs in print queue that you own
ls                           - display sorted contents of directory (excludes .<file> )
ls -a                        - display all entries in directory
ls -l                        - display contents of directory (long format)
ls -t                        - display contents of directory (sort by time modified)
ls -s                        - report size in kilobytes of directory
mail                         - read mail
mail <username>              - send mail to <username>
man [-k keyword] command     - find manual information by keywords; print out the manual
mesg                         - current status of mesg
mesg n                       - deny message via write command
mesg y                       - permit message via write command
mkdir <directory>            - creates <directory> with mode 777
mv <file1> <file2>           - rename <file1> <file2>
mv -i <file1> <file2>        - if <file2> exists, ask if want to overwrite it
mv -f <file1> <file2>        - if <file2> exists, force overwrite of <file2>
nice <command>               - executes command with low priority
nice [#] <command>           - add [#] to base priority 10, higher number-lower priority
passwd                       - change password
pr <file>                    - prepare <file>
pr [-n] <file>               - prepared <file> has  [-n] columns of output
pr [+n] <file>               - begin printing with page [+n]
pr [-h] <string> <file>      - <string> used as page header (default header - date)
pr -l [n] <file>             - length of page [n] (default - 66)
pr -t <file>                 - do not print 5 line header or 5 line trailer
print <file>                 - format <file> before sending to line printer
ps                           - display information about your process
ps a                         - display information about all users processes
pwd                          - display pathname of current directory
rm <file>                    - remove <file> (forced)
rm -i <file>                 - remove <file> (confirmation)
rm -r <file>                 - remove <file> (recursive)
sort <file>                  - sort <file>
sort -b <file>               - ignore leading spaces and tabs
sort -d <file>               - only letters, digits, and blanks are used in comparisons
sort -i <file>               - ignore characters outside ASCII 040-0176 range
sort -t[x] <file>            - tab character separating field is [x]
sort +[pos1] -[pos2]         - start sort at [pos1] and end at [pos2]
sort -o <fileout> <file>     - output file is <fileout>
split <file>                 - divide <file> into 1000 line segments (xaa, xab, ...)
split <file> <fileout>       - divide <file> into 1000s (fileoutaa, fileoutab,...)
split -[n] <file>            - divide <file> into [n] line segments
stty                         - display terminal speed and all options set different from their defaults
stty all                     - display all normally used options
stty everything              - display all stty options
stty erase [c]               - set erase character to [c] - default #
stty kill [c]                - set kill character to [c] - default @
stty intr [c]                - set interrupt character to [c] - default ^?
stty quit [c]                - set quit character to [c] - default stty start [c]
stty stop [c]                - set stop character to [c] - default ^S
stty eof [c]                 - set eof character to [c] - default ^D
stty break [c]               - set break character to [c]
tail <file>                  - display last part of <file>
wc -1 <file>                 - count number of lines in <file>
wc -w <file>                 - count number of words in <file>
wc -c <file>                 - count number of characters <file>
whatis <command>             - display header line from man page for <command>
whereis <key>                - locates source/binary or manual information for <key>
whereis -s <file>            - locate source code for <file>
whereis -b <command>         - locate binary code for <command>
whereis -m <command>         - locate manual information for <command>
who                          - who is on system
who am i                     - current user id
write <ttyname>              - write to <ttyname>
write <username> <ttyname>   - if <username> at more than 1 terminal.
>                            - redirecting output  ( ie.  ls -l > who)
>>  <file>                   - append to end of <file>
&                            - place a job into the background (ie. sort <file> & )
|                            - pipe  ( ie. $who | wc -1  could be used to count # users)


* Note. E-mail addresses for the Department of Computer Science have the form: user_name@cs.arizona.edu
When e-mailing to this Department, substitute the appropriate user name or e-mail alias mentioned on this page for user_name.


Last updated Monday, 07-Jan-2008 09:32:28 MST, by John Luiten
Send questions about this page to