BASIC UNIX COMMANDS
------------------------------------------------------------------------------
INTERACTIVE FEATURES
TAB Command completion !!! USEFUL !!!
UP_ARROW Command history !!! USEFUL !!!
CTRL-C Interrupt current process.
CTRL-D If a program/command waits for input, end input.
------------------------------------------------------------------------------
CONSTRUCTS
COMMAND < FILE COMMAND will take input from FILE.
COMMAND > FILE Put output of COMMAND to FILE
COMMAND >> FILE Append the output of COMMAND to FILE
COMMAND >& FILE Put output and error messages of COMMAND to FILE.
COMMAND >>& FILE Append output and error messages of COMMAND to FILE
COMMAND1 | COMMAND2 Output of COMMAND1 becomes input for COMMAND2
COMMAND | more See the output of COMMAND page by page.
COMMAND & Run COMMAND in the background. Useful under X.
------------------------------------------------------------------------------
ONLINE HELP
h *Custom help.
COMMAND --help | more Basic help on COMMAND.
whatis COMMAND One-line information on COMMAND.
man COMMAND Display the UNIX manual page on COMMAND.
info COMMAND Info help on COMMAND.
xman Browser for Unix manual pages (under X-windows).
apropos KEYWORD | more Find man pages relevant to COMMAND.
perldoc Perl documentation.
------------------------------------------------------------------------------
FILES AND DIRECTORIES
ls List contents of current directory.
ls -l List contents of current directory in a long form.
ls -a Same as ls but .* files are displayed as well.
ls -al Combination of ls -a and ls -a
ls DIRECTORY List contents of DIRECTORY.
ls SUBDIRECTORY List contents of SUBDIRECTORY.
ls FILE(S) Check whether FILE exists (or what FILES exist).
ls $csc221 *List files related to csc221.
Similarly for other courses.
pwd Display absolute path to present working directory.
mkdir DIRECTORY Create DIRECTORY.
cd Change to your home directory.
cd .. Change to the parent directory.
cd SUBDIRECTORY Change to SUBDIRECTORY.
cd DIRECTORY Change to DIRECTORY (specified by a path).
cp FILE NEWFILE Copy FILE to NEWFILE.
cp $csc223/FILE . Copy FILE related to csc223 to the current directory
cp -r DIR NEWDIR Copy DIR and all its contents to NEWDIR.
mv FILE NAME Rename FILE to new NAME.
mv DIR NAME Rename directory DIR to new NAME.
mv FILE DIR Move FILE to existing directory DIR.
quota. *Displays your disk quota and current disk usage.
clean *Remove non-essential files, interactively
clean -f *Remove non-essential files, without interaction.
junk FILE *Move FILE to ~/junk instead of removing it.
rm FILE(S) Remove FILE(S).
rmdir DIRECTORY Remove empty DIRECTORY.
rm -r DIRECTORY Remove DIRECTORY and its entire contents.
rm -rf DIRECTORY Same as rm -r but without asking for confirmations.
locate FILE(S) Search current dir and its subdirs for FILE(S).
targz DIRECTORY *Pack DIRECTORY into archive file *.tgz
untargz ARCHIVE.tgz *Unpack *.tgz archive into a directory.
------------------------------------------------------------------------------
PRINTING
lpr FILE In Hawk101, print FILE from a Unix workstation.
lprint1 FILE *Print text-file on local printer; see help printing
lprint2 FILE *Print text-file on local printer; see help printing
------------------------------------------------------------------------------
PROGRAMMING LANGUAGES
jbuilder Borland's Java Programming Environment for X-windows.
javac CLASSNAME.java Compile a Java program.
java CLASSNAME Run a Java program.
javadoc CLASSNAME.java Create an html documentation file for CLASSNAME.
appletviewer CLASSNAME Run an applet.
lisp *Listener of LISP programming language.
prolog *Listener of Prolog programming language.
make FILE Compile and link C/C++ files specified in makefile
m *Same as make but directs messages to a file.
c-work *Repeatedly edit-compile-run a C program.
cc -g -Wall -o FILE FILE.c Compile C source FILE.c into executable FILE.
gcc -g -Wall -o FILE FILE.c Compile C source FILE.c into executable FILE.
c++ -g -Wall -o FIL FIL.cxx Compile C++ source FIL.cxx into executable FIL.
g++ -g -Wall -o FIL FIL.cxx Compile C++ source FIL.cxx into executable FIL.
gdb EXECUTABLE Start debugging a C/C++ program.
------------------------------------------------------------------------------
TEXT FILES
more FILE Display contents of FILE, page by page.
less FILE Display contents of FILE, page by page.
cat FILE Display a file. (For short files.)
head FILE Display first lines of FILE.
tail FILE Display last lines of FILE.
emacs FILE Edit FILE using Emacs editor.
pico FILE Edit FILE using a user-friendly editor.
ispell FILE Check spelling in text-file FILE.
cat FILE1 FILE2 > NEW Append FILE1 and FILE2 creating new file NEW.
cat FILE1 >> FILE2 Append FILE1 at the end of FILE2.
sort FILE > NEWFILE Sort FILE, putting sorted version into NEWFILE.
grep ITEM FILE(S) Display lines of FILE(S) which contain ITEM.
grep. ITEM FILE(S) *Similar as above, but better.
wc FILE(S) Count characters, words and lines in FILES.
diff FILE1 FILE2 | more Show differences between two versions of a file.
filter FILE NEWFILE *Filter out strange characters from FILE.
------------------------------------------------------------------------------
INTERNET
lynx Web browser (for text based terminals).
lynx FILE.html Display local html file.
netscape Web browser.
netscape FILE.html Display local html file.
telnet HOST *Open interactive session on HOST using telnet.
ssh HOST *Open interactive session on HOST using secure shell.
ftp HOST *Open ftp (file transfer) connection to HOST.
pine High quality text-based e-mail manager.
------------------------------------------------------------------------------
PROCESS CONTROL
CTRL-Z Suspend current foreground process.
fg Bring job suspended by CTRL-Z to the foreground.
ps. *List processes.
jobs List current jobs (A job may involve many processes).
kill. PROCESS *Kill process.
------------------------------------------------------------------------------
MISCELLANEOUS
exit Exit from any shell.
logout Exit from the login shell and terminate session.
passwd Change password.
xcalc Electronic calculator under X-windows.
xclock A clock under X windows.
xeyes They watch you work and report to the Boss :-)
date Display date and time.
clear Clear screen or shell window.
xrefresh Refresh X-windows.
reset *Reset session.
------------------------------------------------------------------------------
Notice that for some standard Unix commands, a friendlier
versions have been implemented; the names of resulting commands end with a
period.