Unix Command Reference

LIST FILE NAMES
DIRECTORIES
FILE UTILITIES
COMPILERS
USEFUL UNIX COMMANDS
LOGGING OFF


LIST FILE NAMES

ls
lists the files in the current directory
ls -l
lists the files in long format
ls -F / /usr
lists the files in directories / and /usr showing directories(/) and executable files
ls -al
list all files in the current directory (including administrative files whose names start with a . such as .login ) in the long format


DIRECTORIES

cd xyz
change directory to xyz directory (relative path name)
cd ..
change directory to the parent of current directory
cd
change directory to users home directory
cd /usr/bin
change directory to /usr/bin (full pathname)
pwd
print(show) working directory
mkdir xyz
creates directory xyz
rmdir xyz
removes empty directory xyz
rm -r xyz
removes directory xyz and all files in it (recursive)


FILE UTILITIES

cat fln
lists the file fln to screen
cat > f1
puts the data typed next into f1 (output redirection)
cat >> f1
appends the data typed next into f1
cat f1 f2 > f3
concatenates f1 and f2 and places in f3

tail f1
lists the last 10 lines of f1 to screen
tail -23 f1
lists the last 23 lines of f1 to screen
head f1
display the first 10 lines of f1 to screen
more f1
shows one screen of f1 and waits for input
wc f1
gives the word, line, and character count for file f1

rm f1
removes f1 from the current directory
rm -i f1
checks with the user for confirmation before removing

mv f1 f2
gives the new name f2 to f1
mv f1 /xyz
moves f1 to directory /xyz (not copied, completely moved)

cp f1 f2
makes a copy of f1 named f2
cp -i f1 f2
warns user if f2 already exists before overwriting

pr source.c
prints a formatted form of source.c to screen


COMPILERS

cc fln.c
compiles the C program fln.c
f77 fln.f
compiles the FORTRAN program fln.f


USEFUL UNIX COMMANDS

mailx

|
a "pipe" - takes the output of one command and makes it the input of another
e.g. ls | more lists the files in the current directory and pipes it through more (for when there are large numbers of files)
date
shows date and time
who
reports who is currently logged in
write tom
the next message typed (terminated with Control-D) will be sent to user tom's screen (only if both users are logged onto the same computer)
ytalk tom
allows two way communication with split screen
mesg n
turns off other users' permission to write to your terminal
mesg
reports on the current status of mesg
displays your mail
mailx tom
mails the next lines typed (terminated with Control-D) to user tom
mailx usr < fln
mails the contents of file fln to usr

stty -a
gives the terminal settings
stty option
sets the option for the terminal
e.g. stty erase "backspace" activates the backspace key (NB: "backspace" may appear as ^H or similar)
sort f1
displays a lexicographically sorted listing to the terminal
sort f1 | uniq
displays a lexicographically sorted listing of all the unique lines in the file f1 (by taking the output of the sort command and making it the input to the uniq command)
grep xx f1
displays all the lines in file f1 which contain the string xx
diff f1 f2
displays lines of textfiles f1 and f2 that differ
cmp b1 b2
report the first position where (binary) files b1 and b2 differ
file f1
give the file type of f1

history
gives a numbered list of the last 50 commands entered
!45
re-executes the 45th command
!c
re-executes the last command beginning with a c
!!
re-executes the most recent command

alias
lists current alias settings
alias alias-string command
allows usage of alias-string in replacement of command

source .cshrc
sources .cshrc file (.cshrc file must be in working directory).


LOGGING OFF

logout
disconnects your account