Unix Guide


Home
Commands relevant to Programming Environment are printed in bold

Getting Help

command action
man command show the manual page for a command
man -k keyWord list commands related to a keyword

Some commands are built into the shell (csh). For these, see man csh.

Using Files

command action
cat file1 file2 ...
cat > fileName
copy (concatenate) files to standard output
copy standard input (keyboard) into fileName
cp oldFile newFile
cp file1 file2 .. destDir
copy a file
copy lots of files to destination directory
mv oldName newName
mv file1 file2 ... destDir
move (rename) a file
move lots of files to destination directory
ln origName linkName link (add a new directory entry) for a file
similar effect to cp
rm file1 file2 ...
rm *
remove (delete) a file(s)
be careful with wildcharacters
chmod [ugo][+|-][rwx] change the mode (protection codes) for a file(s)

Working with Text

command action
more fileName
less fileName
show a file, one screenful at a time, on standard output
lpr fileName print a file on a printer
vi fileName
ee fileName
pico fileName
character based text editors
nedit fileName windows based text editor
spell fileName
ispell fileName
spelling checkers
ispell is interactive
wc fileName count characters, words and lines in a file
grep pattern file(s) search files for patterns and words
diff file1 file2 find differences between files
sort file1 file2 .. combine and sort the files contents
uniq fileName remove duplicate lines

Using Directories

command action
ls [-al] list directory contents
cd destDir change current working directory
pwd show working directory
mkdir newDirName make a new directory
rmdir dirName remove a directory
(it must be empty first)
rm -r dirName remove a directory tree (all its files - be very careful)
find startDir -name fileName -print search a directory tree for a file and print result

Printing files

command action
lp fileName print file to default printer (itlab3)
lpr -Pprinter fileName print to named printer
printers are: itlab3, itlab5, englab
lpq
lpq -Pprinter
view queue of default printer
view queue on named printer

Users (you & others)

command action
exit
^D
log out of session
passwd change your password (this needs to be done on ironbark and redgum separately)
who list current users on the computer
whodo list current users and what they are doing
who am i identify the current user

Internet Utilities

command action
lynx WWW browser (text based)
netscape
netscape &
WWW browser (windows based)
talk talk to another user on the internet
elm send & read electronic mail
ftp compName transfer files across the internet
rlogin compName remote login to another computer via your current login

Programming

command action
cc, gcc, lint, cb, indent C compilers, verifiers & formatter
CC fileName.c++
CC -o exeFile inFile.c++
g++ -o exeFile fileName.c++
C++ compilers
make fileName.mak automatic system building

Processes

command action
env list the process environment (contents of variables)
setenv set the value of an environment variable
ps  list processes on the computer
kill pid kill (interrupt) a process
^C interrupt the current foreground process
^Z stop (freeze) the current foreground process (job)
stop stop (freeze) a background process (job)
fg resume a stopped job in the foreground
bg resume a stopped job in the background
jobs list your current jobs
nice execute a job at low priority
time time a command

Miscellaneous Utilities

command action
sc spreadsheet calculator
date show date & time
du show disk usage
df show disk free space
script capture a terminal session to a file

Shell Special and Meta Characters

These are interpreted by the shell - see man csh.
 
characters action
echo echo back the string entered, after any meta characters are processed
    > file redirect standard output to a file
    < file redirect standard input from a file
   >> file redirect standard output and append to a file
   << mark input from a here document (continues to next occurrence of mark)
c1 | c2 pipe the standard output of command c1 to the standard input of c2.
* match any string of characters
? match any one character
[xyz] match one of x, y, or z
$var replaced by the contents of the variable var
'string' string is literal (not interpreted)
c1 ; c2 do command c2 after completing c1
command & do command as a background job, eg: 
netscape &
. interpreted as the current working directory
.. interpreted as the parent of the current working directory
~ interpreted as the user's home directory

Command Line Editing

command action
set filec enable filename completion
<Escape> complete partly typed filename
history list the last few commands used
!! repeat the last command
!97 repeat command no 97 (from history list)
!-3 repeat third last command
!str repeat last command which started with str
^ttt^sss substitute sss for ttt in last command, and redo
!97:s/ttt/sss/ substitute sss for ttt in command 97, and redo

This file was created by Peter Goddard.