UNIX Commands and Packages

Type ^X^D (control-X control-D) in a Linux terminal window to get a listing of some commands available on that system. Here is a selection of commands that can be run at the prompt of a Linux terminal window, followed by a brief description, and, in some cases, an example. To know more about each command, run "man commandname"; for example, "man cal" accesses the on-line manual for information about cal. To get help on running a command, you can try the manual; you can also try "commandname --help" to get some information on usage. There are many more commands. List the contents of /bin and /usr/bin to see more. If you want to know where one of the commands below resides, use "whereis commandname". If you know a command, you can use this to find where it is located, and you can then list the contents of the directory it resides in to see what other commands are defined there.
apropos  : search the whatis database for strings
at       : schedule commands (read from a file, say) to run at specified times
awk      : pattern matching programming language
           cat tmp | awk '{print $2 OFS $1}' : outputs the first two words of each 
           line of the file tmp with a space (OFS) between, putting the second word first
bc       : basic calculator
cal      : calendar : "cal 9 2003" gives the calendar for September 2003
cat      : print out a file
cc       : run c compiler (output is directed to a.out)
chgrp    : change group
chmod    : change file permissions : "chmod 600 foo" restricts access of foo to you 
chown    : change file owner
cp       : copy
date     : date
diff     : compare two files
domainname : get network information
du       : get disk usage
dvips    : print dvi file (this can also convert the dvi file to a ps file)
echo     : echo an input
emacs    : text editor
env      : print out environmental variables
find     : find a file
finger   : obtain information on users
free     : display memory usage
gnuplot  : plotting program
grep     : match patterns :
           ls -l | grep "^.......rw"  : list files others can read from and write to 
           ls -l foo/* | grep "\.tex"  : list files in directory foo which end in .tex 
           ls -l foo/* | grep -v "\.tex"  : list files in directory foo which do not end in .tex 
           cat foo | grep t..s  : list lines in file foo with t and s separated by any two characters 
           cat foo | grep ^for  : list lines in foo which start with "for"
           cat foo | grep for$  : list lines in foo which end with "for"
           cat foo | grep "[1-9][0-9]" : list lines in foo having a number of two or more digits
           cat foo | grep "[^0-9][1-9][^0-9]" : list lines in foo having a digit preceded and followed by a nondigit
           cat foo | grep "1.*4" : list lines in foo where a 1 is eventually followed by a 4
           grep ring *04/* : searches all files (that's the second star) in directories (in the current directory) 
                where the directory's name (this is the first star) ends in 04; it prints the line
                and filename for any line in any such file containing the string "ring"
hostname : get network information
kill     : stop a process
latex    : run LaTeX
latex2html : convert a LaTeX file
lpq      : check the print job queue
lpr      : send a file to the printer : "lpr -# 7 filename" : Print 7 copies of the file filename
lprm     : remove a print job
lpstat   : printer queue information
ls       : list contents of a directory
           ls -l (long listing)
           ls -t (list younger files first)
           ls -R (list contents of all subdirectories recursively)
           ls -lt (do each of the options l and t)
M2       : run Macaulay 2
           cat tmp | M2 >& ttt & : run M2 commands in tmp in the background and direct all output to file ttt
           cat tmp | M2 >>& ttt & : run M2 commands in tmp in the background and append all output to file ttt
           nohup M2 < tmp >& ttt & : same as first except continues to run after log out
           (in last example, when you login later, use "ps -x" to check status of the job)
mail     : send mail
mkdir    : create a directory
mac2unix : convert carriage returns in an ascii file to linefeeds
man      : access the manual pages : man grep : check man page for grep
more     : modulate screen display
mv       : move a file
nice     : run a process under low priority
nohup    : set a process to continue after log out (see example under M2)
passwd   : change your password
pdf2ps   : convert pdf file to postscript
pdflatex : output a LaTeX file as pdf (rather than dvi)
perl     : flexible interpreted programming language
pine     : mail program
ps       : list current processes
ps2ascii : can be used to recover ascii from a pdf file; e.g., ps2ascii my.pdf > my.txt
ps2pdf   : convert postscript file to pdf format
pwd      : list Pathname of Working Directory
rm       : remove a file
rmdir    : remove a directory
scp      : Secure copy, from one account to another. Example:
           scp "pathname of file in current account" "remote account name:new name and path"
           scp /Users/me/Documents/myfile.jpg me@math.unl.edu:newname.jpg
           (You will be asked for your me@math.unl.edu password)
sed      : stream editor (does pattern matching and substitutions)
           cat tmp | sed 's/^/-- /' : list lines of file tmp, but insert "-- " at start of each line
           cat tmp | sed 's/$/-- /' : list lines of tmp, but insert "-- " at end of each line
           cat tmp | sed 's/^-- //' : list lines of tmp, but delete any occurrences of "-- " at start of a line
           cat tmp | sed 's/i.*l/x/' : list lines tmp, but substitute an x for strings beginning with i and ending with l
sort     : sort input
ssh      : secure login
tex      : run TeX
talk     : communicate directly with another user
tar      : put a file or list of files into a single file archive
           "tar cvf archive.tar *.tex" : Create a tar file named archive.tar consisting
           of all files in the current directory and ending in .tex
           "tar xvf archive.tar" : extract files from the tar file
top      : display current processes
vi       : text editor
w        : display current users and what they are doing
wc       : word count
           "cat tmp | wc" : outputs counts of lines, words and characters of file tmp
whatis   : search the whatis database for complete words
whereis  : locate the binary, source, and manual page files for a command
which    : shows the full path of (shell) commands
who      : show who is logged on : "who | grep mary" : check if mary is logged on
whoami   : shows who you are (useful when logged in to multiple accounts)