UNIX COMMANDS

04/09/2009 16:53

Terminal control characters for C-shell

^h, backspace erase previously typed character
^u erase entire line of input so far typed
^d end-of-input for programs reading from terminal
^s stop printing on terminal
^q continue printing on terminal
^z suspend currently running job; restart with bg or fg
DEL, ^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)
keeptoken request longer lifetime for kerberos ticket so long-running jobs can access AFS files

Information

date show date and time
history list of previously executed commands
pine read or send email messages or networks news groups
msgs display system messages
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
finger find out info about a user@system
whois look up information in the Stanford Directory

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 line 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 (remove files first)
mv change name of directory
pwd show current directory

Devices

df summarize free space on disk drive
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
DEL, ^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 print process screen
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 (in .login)
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

pine process mail with fill-screen menu interface or read USENET news groups
msgs read system bulletin board messages
mail 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
finger translate real name to account name for email
whois look up email addresses in the Stanford Directory
talk interactive communication in real-time (chat)
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 editory for X Window terminals
pico very simple text editor, same as pine Compose screen
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
pinex send or recieve mail messages
xemacs GNU emacs editor
gv interface to contol gs to display PostScript or PDF files on screen
xdvi display DVI files on X Window (screen preview)
netscape web browser
gnuplot interactive data plotting on screen

TeX typesetting system

tex process TeX files to DVI (device independent) output
latex process LaTeX files to DVI
texpr process and print TeX and LaTeX in one step
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

lpr send file to print queue
lpq examine status of files in print queue
lprm remove a file from print queue
op lpc
abort qname
abort print queue qname to clear printer (all files saved)
op lpc
start qname
restart print queue qname
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; 1985 vers.
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
GMT general 2D and 3D data processing and plotting software package; also plots maps
gs "ghostscript" converter displays PostScript files on X Window displays or other devices

Networking/communications

klogin remote login to kerberized computer; encrypted
krsh execute single command on remote kerberized computer; encrypted
krcp remote file copy to/from kerberized computer; encrypted
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
ftp network file transfer program - plain text passwords
rlogin remote login to "trusted" computer that is not kerberized
rsh execute single command on remote "trusted" computer
rcp remote file copy to/from "trusted" computer
host find IP address for given host name, or vice versa
netscape web browser for X Window terminals/servers
lynx web browser for character based (text-only) terminals
kermit transfer files over modem connections
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 Compaq(HP) Fortran 77 compiler
f95 Compaq(HP) Fortran 90/95 compiler
f2c convert fortran source code to C source code
cc, c89 Compaq(HP) ANSI 89 standard C compiler
cxx Compaq(HP) C++ compiler
gcc GNU C compiler
g++ GNU C++ compiler
pc Compaq(HP) Pascal compiler
dbx command-line symbolic debugger for compiled C or Fortran
ladebug X Window symbolic debugger for compiled C or Fortran
make recompile programs from modified source
gmake GNU version of make utility
cflow generate C flow graph
error analyze and disperse compiler error messages

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
Back