CO132 Introduction to UNIX
Commonly Used UNIX Commands

Notes

Optional portions are surrounded by square brackets. N is used for any number.

basename
basename pathspec [ext]

remove any directory (and/or extension) from pathspec, leaving just the BASENAME (filename)
cancel
cancel jobid

CANCEL a print job
cat
cat [file [file ...]]

conCATenate files together or show on the screen
clear
clear the screen
cmp
cmp file1 file2

CoMPare two (binary) files and report if they are different
cp
cp file1 file2 or cp file1 ... filen dir

CoPy files
date
what time is it?
df
df [-kl] [dir]

show how much of a Disk is Free
diff
diff file1 file2

compare two files looking for DIFFerences
dirname
dirname pathspec

remove any basename from pathspec, leaving just the DIRectory NAME
dos2unix
dos2unix dosfile unixfile

convert a DOS text file to a UNIX text file (Solaris only)
echo
ECHO all command line arguments on standard output
grep
grep pattern [ file [ file...]]

search Globally through the file for a Regular Expression and Print each line where it is found
head
head -N [file [file ...]]

show me the HEAD of a file
hostname
what machine am I on
line
line

read one LINE from standard input and write it to standard output (Solaris only)
lc
lc [opt] [dir ...]

List the Contents of a directory
lpstat
lpstat [opt]

show the LinePrinter STATus
ls
ls [opt] [file ...]

LiSt the contents of a directory
man
man something

show me the MANual page about something
mkdir
mkdir dir [...]

MaKe a DIRectory
more
more [file ...]

show me MORE of the file
mv
mv file1 file2 or mv file1 .. filen dir

MoVe files (rename them)
netscape
surf the net
passwd
change your PASSWorD
printenv
printenv [var]

PRINT out ENVironment variables
rm
rm [opt] file [file ...]

ReMove files (delete them)
rmdir
rmdir dir [...]

ReMove a DIRectory (it must be empty)
sed
sed -e editstring [file]

Stream EDitor
set
set [var=value]

SET or show environment settings
stty
stty [options]

Show or set TTY (terminal) settings
tail
tail -N [file]

show me the TAIL of a file
tr
tr from_set to_set

TRansliterate characters in from_set to the corresponding character in to_set
uname
tell me more about the machine
unix2dos
unix2dos unixfile dosfile

convert a UNIX text file to a DOS text file (Solaris only)
uptime
how long has the machine been up?
volcheck
CHECK for a mountable VOLume (typically a floppy or cdrom) and, if found, mount it (Solaris only)
w
what are they all doing?
which
WHICH command will I run?
who
WHO else is logged onto the system?