ommon unix commands and utilities
Copyright Phillip Farrell. Last revision August 6, 2010
This page was created to list commonly used Unix commands and useful utilities that
were available on a time-sharing Tru64 Unix system operated by the School of Earth
Sciences in the early 2000s.
This page was edited in 2010 to remove special programs that were only available on the
School's system, which is no longer in use. The remaining commands and utilities listed
here should be available for all varieties of Unix and Linux, including Mac OS X (from
the Terminal application).
Program listings are organized by general subject categories. Keys preceded by a ^
character are CONTROL key combinations. Access the online manual with the man
program to get more information on these programs, for example,
man cp
To find a program not on this list (and there are hundreds), try the man program with the
-k option followed by a keyword, for example,
man -k tape
to find all on-line manual entries that refer to programs that work with tapes.
Terminal control characters for C-shell (csh)
^h,
erase previously typed character
backspace
^u erase entire line of input so far typed
^d end-of-input for programs reading from terminal
^s suspend writing to terminal (freezes terminal)
^q continue writing to terminal
^z suspend currently running job; restart with bg or fg
^c kill currently running program and allow clean-up before exiting
^\ emergency kill of currently running program with no chance of cleanup
Also see a list of special characters that should not be used in filenames.
Login and authentication
login access computer; start interactive session
logout disconnect terminal session
passwd change local login password; you must set a strong password that is not
easily guessed
kinit obtain kerberos ticket for connections to other kerberized computers
kdestroy destroy kerberos tickets (authorizations)
Information
date show date and time
history list of previously executed commands
man show online documentation by program name
info online documentation for GNU programs
w, who who is on the system and what they are doing
whoami who is logged onto this terminal
top show system stats and top CPU using processes
uptime show one line summary of system status
File management
cat combine files
cp copy files
ls list files in a directory and their attributes
mv change file name or directory location
rm remove files
ln create another link (name) to a file
chmod set file permissions
crypt encode/decode a file with a private key
gzip, gunzip compress/decompress a file
find find files that match specific criteria
Display contents of files
cat copy files to display device
more show text file on display terminal with paging control
head show first few lines of a file(s)
tail show last few lines of a file; or reverse line order
vi full-featured screen editor for modifying text files
pico simple screen editor for modifying text files
grep display lines that match a pattern
lpr send file to printer
pr format file with page headers, multiple columns, etc.
diff compare two files and show differences
cmp compare two binary files and report if different
comm compare two files; show common or unique lines
od display binary files as eqivalent octal/hex codes
strings show printable text embedded in binary files
file examine file(s) and guess type: text, data, program, etc.
wc count characters, words, and lines in a file
Directories
cd change to new directory
mkdir create new directory
rmdir remove empty directory (you must remove files
first)
mv change name of directory
pwd show current directory
Disks
df summarize free space on disk filesystems
du show disk space used by files or directories
Special character handling for C-shell (See man csh)
* match any characters in a file name
~user shorthand for home directory of user
$name substitute value of variable name
\ turn off special meaning of character that follows
' in pairs, quote string with special chars, except !
" in pairs, quote string with special chars, except !, $
` in pairs, substitute output from enclosed command
Controlling program execution for C-shell (See man csh)
& run job in background
^c kill job in foreground
^z suspend job in foreground
fg restart suspended job in foreground
bg run suspended job in background
; delimit commands on same line
() group commands on same line
! re-run earlier commands from history list
jobs list current jobs
ps show process information
kill kill background job or previous process
nice run program at lower priority
at run program at a later time
crontab run program at specified intervals
limit see or set resource limits for programs
alias create alias name for program (normally used in .login file)
sh, csh execute command file
Controlling program input/output for C-shell (See man csh)
| pipe output to input
> redirect output to a storage file
< redirect input from a storage file
>> append redirected output to a storage file
tee copy input to both file and next program in pipe
script make file record of all terminal activity
Email and communication
msgs read system bulletin board messages
mailx send/read email; can be run by other programs to send exisiting files via
email
uuencode
uudecode encode/decode a binary file for transmission via email
rn read USENET news groups
Editors and formatting utilities
sed programmable text editor for data streams
vi full-featured editor for character terminals
emacs GNU emacs editor for character terminals
xemacs GNU emacs editor for X Window terminals
pico very simple text editor
fmt fill and break lines to make all same length
fold break long lines to specified length
X Window client programs (output to X terminal or server)
xterm provide login shell window
xauth manipulate authorization files
xload show system load
xman full screen online manual viewer
xemacs GNU emacs editor
interface to contol gs to display PostScript or PDF files on
gv
screen
xdvi display DVI files on X Window (screen preview)
gnuplot interactive data plotting on screen
TeX typesetting system
tex process TeX files to DVI (device independent) output
latex process LaTeX files to DVI
dvips print DVI files on Postscript laser printer
xdvi display DVI files on X Window (screen preview)
latex2html translate LaTeX files to HTML (for web pages)
Printing (BSD based)
lpr send file to print queue
lpq examine status of files in print queue
lprm remove a file from print queue
enscript convert text files to PostScript format for
printing
Interpreted languages and data manipulation utilities
sed programmable text editor for data streams
awk pattern scanning and processing language
perl Practical Extraction and Report Language
sort sort or merge lines in a file(s) by specified fields
tr translate characters
cut cut out columns from a file
paste paste columns into a file
dd copy data between devices; reblock; convert EBCDIC
Graphics and mapping
gnuplot interactive data plotting; outputs to PostScript or X Window
gs "ghostscript" converter displays PostScript files on X Window displays or
other devices
Networking/communications
ssh remote login/command execution; encrypted
scp remote non-interactive file copy; encrypted
sftp remote interactive file copy; encrypted
telnet remote network login; plain text password - not recommended
ftp network file transfer program; plain text password - not recommended
host find IP address for given host name, or vice versa
lynx web browser for character based (text-only) terminals
gzip, gunzip compress/decompress a file
tar combine multiple files/dirs into single archive
uuencode
uudecode encode/decode a binary file for transmission via email
Compilers, interpreters and programming tools
csh command language interpreter (C-shell scripts)
ksh command language interpreter (Korn-shell scripts)
sh command language interpreter (Borne-shell scripts)
f77 Fortran 77 compiler
f2c convert fortran source code to C source code
gcc GNU C compiler
g++ GNU C++ compiler
dbx command-line symbolic debugger for compiled C or Fortran
make recompile programs from modified source
cflow generate C flow graph
Programming libraries (see man library_name)
lapack Fortran 77 routines for numerical linear algebra (supersedes LINPACK
and EISPACK)
X routines to interface with X window system (no man page -- get the X
Toolkit book)
dbm database routines
xdr library routines for external data representation
netcdf routines for machine independent data representation
Tape manipulation and archiving
mt manipulate tape drive and position tape
dd unformatted tape read and write; file conversion
tar archive disk files on tape or disk
ltf read/write ANSI standard label tapes
UNIX Command Summary
There are MANY commands available for you in a UNIX shell account. A list of them
follows (in no particular order). Remember, you can always read the manpage on each
command for more information.
ls ................. show directory, in alphabetical order
logout ............. logs off system
mkdir .............. make a directory
rmdir .............. remove directory (rm -r to delete folders with
files)
rm ................. remove files
cd ................. change current directory
man (command) ...... shows help on a specific command
talk (user) ........ pages user for chat - (user) is a email address
write (user) ....... write a user on the local system (control-c to end)
pico (filename) .... easy to use text editor to edit files
pine ............... easy to use mailer
more (file) ........ views a file, pausing every screenful
sz ................. send a file (to you) using zmodem
rz ................. recieve a file (to the unix system) using zmodem
telnet (host) ...... connect to another Internet site
ftp (host) ......... connects to a FTP site
archie (filename) .. search the Archie database for a file on a FTP site
irc ................ connect to Internet Relay Chat
lynx ............... a textual World Wide Web browser
gopher ............. a Gopher database browser
tin, trn ........... read Usenet newsgroups
passwd ............. change your password
chfn ............... change your "Real Name" as seen on finger
chsh ............... change the shell you log into
grep ............... search for a string in a file
tail ............... show the last few lines of a file
who ................ shows who is logged into the local system
w .................. shows who is logged on and what they're doing
finger (emailaddr).. shows more information about a user
df ................. shows disk space available on the system
du ................. shows how much disk space is being used up by
folders
chmod .............. changes permissions on a file
bc ................. a simple calculator
make ............... compiles source code
gcc (file.c) ....... compiles C source into a file named 'a.out'
gzip ............... best compression for UNIX files
zip ................ zip for IBM files
tar ................ combines multiple files into one or vice-versa
lharc, lzh, lha .... un-arc'ers, may not be on your system
dos2unix (file) (new) - strips CR's out of dos text files
unix2dos (file) (new) - adds CR's to unix text files