For each command, its syntax and a very
brief description of what it does are given.
The commands are divided into three sections.
For more details, check
manuals, or for on-line help, type to the UNIX prompt
This section contains a list of the most interesting, most basic UNIX
commands. "Most interesting" is measured in the subjective opinion
of the author. Anyone wishing to suggest additions to this document
is welcome to do so. Some commands are specific to WPI.
Mathematical Sciences WWW Server
UNIX Commands
by Joseph D. Fehribach
< bach@wpi.edu >
man <command>
with <command> replaced by the individual commmand name.
Most Basic Commands
cp oldfile newfile . . . CoPy OLDFILE to NEWFILE
cp oldfile newdir . . . CoPy OLDFILE to NEWDIRectory
mv oldfile newfile . . . MoVe OLDFILE to NEWFILE (renames OLDFILE)
mv oldfile newdir . . . MoVe OLDFILE to NEWDIRectory
ls . . . LiSt contents of present working directory
ls -la . . . LiSt, Long-format, All contents (dots included)
ls directory . . . LiSt contents of DIRECTORY
pwd . . . identifies Present Working Directory
cd . . . Change Directory to home directory
cd dirname . . . Change Directory to directory DIRNAME
cd - . . . Change Directory to previous directory
mkdir dirname . . . MaKe DIRectory DIRNAME
rm oldfile . . . ReMove OLDFILE
rm -r dirname . . . ReMove DIRNAME (and everything in it)
rmdir dirname . . . ReMove DIRectory DIRNAME (but only if empty)
pine . . . read your mail with PINE (an easy mail reader)
mail . . . enter MAIL to read your own mail
mail user@address . . . enter MAIL to send a message to USER at ADDRESS
more filename . . . display file FILENAME using MORE paging format
command | more . . . "pipe" COMMAND through the MORE paging format
less filename . . . display file FILENAME using LESS paging format
command | less . . . "pipe" COMMAND through the LESS paging format
Note: The command "more" is designed to keep long displays
from scrolling off the screen before they can be read.
Inside "more"
. . . down one line
. . . down one screen
q . . . Quit
h . . . Help (displays all command options)
"less" works in much the same way, but allows additional
options (basically those of the vi editor). Most people
prefer "less" to "more."
vi filename . . . edit FILENAME with VI editor
view oldfile . . . VIEW an existing OLDFILE with vi editor
emacs filename . . . edit FILENAME with EMACS editor
pico filename . . . edit FILENAME with PICO editor
dxnotepad filename . . . edit FILENAME with DXNOTEPAD editor
tex paper.tex . . . create a dvi-file from the TeX file PAPER.TEX
latex paper.tex . . . create a dvi-file from the LaTeX file PAPER.TEX
lpr -Pprntr file . . . send ascii/postscrpt FILE to LaserPRinter PRNTR
lpq -Pprinter . . . check the LaserPrinter Queue for PRINTER
lprm -Pprinter XXX . . . ReMove entry number XXX from queue for PRINTER
dvips -Pprinter file.dvi . . send DVI FILE to PRINTER
man command . . . display MANual page for COMMAND
telnet computername . . . TELNET to any internet COMPUTERNAME
rlogin computername . . . Remote LOGIN to any internet COMPUTERNAME
computername . . . remote login to a wpi COMPUTERNAME
exit . . . EXIT current shell, return to previous shell
logout . . . LOGOUT (only from login shell)
Commands in this list are more advanced than those on the first list, but in some cases (e.g. "mail"), these may no longer be the optimal commands to choose for many users.
who . . . WHO is currently on your workstation
w . . . similar to "who" but different format
finger . . . what users are currently logged-in at WPI
finger username . . . display info on user USERNAME
last | more . . . display all recent logins
last -n . . . display LAST "N" logins
last . . . a very silly command to enter from a terminal
mail . . . enter MAIL to read your own mail
mail user@address . . . enter MAIL to send a message to USER at ADDRESS
write user . . . enter WRITE to send message to a logged-in USER
talk user . . . enter TALK to open two-way channel with USER
pine . . . read your mail with PINE (an easy mail reader)
elm . . . read your mail with ELM (more powerful reader)
df . . . Display Filesystem status
du . . . Display sizes of files/subdir in current dir
du dirname . . . Display sizes of files/subdir in DIRNAME
du -s . . . Display total size of current DIRNAME
ps . . . display information on current users ProceSses
ps -aux | more . . . display much info on all ProceSses on sun
diff file1 file2 . . . compare DIFFerences between ascii FILE1 & FILE2
passwd . . . set PASSWorD
chmod XXX file . . . CHange MODe (permissions) on FILE using XXX
chown newowner file . . . CHange OWNer of FILE to NEWOWNER
chgrp newgroup file . . . CHange GRouP of FILE to NEWGROUP
cat file . . . display FILE ("more" and "less" are superior)
cat file1 > file2 . . . same as "cp file1 file2"
cat file1 >> file2 . . . append FILE1 to the end of FILE2
cat > file . . . create FILE and open it to typed terminal input
cat >> file . . . append typed terminal input to FILE
cal XXXX . . . display CALendar for year XXXX
cal n XXXX . . . display CALendar for Nth month of year XXXX
date . . . display current DATE and time
spell file . . . check SPELLing in an ascii FILE
ispell file . . . check spelling in an ascii FILE with ISPELL
alias name 'string' . . . make NAME equivalent to STRING (often in .cshrc)
unalias name . . . UNdo an ALIAS
compress file . . . replace FILE by smaller file.Z to save diskspace
uncompress file.Z . . . return FILE.z to original state, i.e., file
gzip file . . . replace FILE by smaller file.gz
gunzip file.gz . . . return FILE.gz to original state, i.e., file
grep express file . . . display all lines of FILE containing EXPRESSion
(from "Get Regular Expression Please" maybe)
chfn . . . CHange FiNger information
gred . . . GRoup file EDitor
Wild Cards:
* . . . wild card for an arbitrary number of characters
? . . . wild card for a single character
Example: mv *file newdir --- MoVe every file ending in FILE to NEWDIR
mv ? newdir --- MoVe files with single-character names to NEWDIR
Control Characters:
^D . . . depending on context, end-of-file, exit, or logout
^C . . . kill current process
^Z . . . stop current process ( % will restart)
^S . . . freeze the display ( "more" is often superior)
^Q . . . unfreeze the display
^U . . . clear command line (delete everything since last return)
% . . . restart most recently stopped process in foreground
fg %n . . . restart process N (bring process N to ForeGround)
%n . . . same as "fg %n"
% & . . . restart most recently stopped process in background
bg %n . . . restart process N (put process N in the BackGround)
%n & . . . same as "bg %n&"
command & . . . execute COMMAND in the "background"
!! . . . re-execute the last command
!-n . . . re-execute the Nth previous command (relative)
!n . . . re-execute the Nth command from history (absolute)
!xyz . . . re-execute the last command which begins XYZ
^xxxx^yyy^ . . . re-execute last command, replacing XXXX by YYY
!$ . . . repeat last word of last command
Note: additional words may be added to each of the above five; e.g. if the
last command is "cd" then "man !!" is equivalent to "man cd"
~ . . . home directory
. . . . present working directory
.. . . . parent of present working directory
string > file . . . direct the output of STRING to FILE instead of screen
string >! file . . . direct output of STRING to FILE even if noclobber is set
string >& file . . . direct stardard output & stardard error to FILE
string >> file . . . append the output of STRING to FILE
string < file . . . use contents of FILE as input for STRING