UNIX Introduction and
Quick Reference
Quick Reference
Commands may need additional information, such as
file or directory names, which are typed immediately
following the command name. Clarification and
syntax for any command is available by typing man
commandname after the % prompt and then
pressing Return.
Information applications
Basic file commands
Network commands
cat
cp
ls
ls l
mv
rm
ftp
rcp
rcp r
telnet
ssh
concatenate or display files
copy files
list file names
list file names, sizes, attributes
move or rename files
remove files
apropos
gopher
man
rn, trn, tin
locate commands by keyword
local and worldwide information
access
display entries from online manual
read Usenet news
general file transfer utility
copy files between UNIX systems
copy entire directory tree
connect to a remote system to log in
connect via a secure channel to a remote
system to log in
Editors
Controlling applications
The easiest editor to use is pico. The vi, jove, and
emacs editors are also available.
fg
jobs
kill
ps
^C
^Z
^S
^Q
Mail
The easiest mail program to use is pine. The elm and
mail mail programs are also available.
Other file commands
diff
fmt
grep
head
less
more
sort
tail
wc
wc l
compare two files
simple line adjuster for mail
scan a file for a pattern
display the first ten lines of a file
display file one screen at a time
display file one screen at a time
sort/merge utility
display the last ten lines of a file
count lines, words, characters in a file
count lines
restart a suspended command
display suspended commands
kill a command
display commands with process numbers
interrupt currently running process
suspend currently running process
stop output on screen
continue output on screen
Miscellaneous
chfn
clear
date
finger
lpr
passwd
who
change information shown by finger
clear screen
display date and time
show information about users
send file to printer
change password
tell who is logged in
Commands
UNX 1.4.5 August 1995-2003
cd
mkdir
pwd
rm r
rmdir
change to a different directory
make a directory
print the current directorys name
remove directory & all files in that directory
remove empty directory
Information Systems and Technology
University of California
Berkeley, Ca 94720-3812
UNIX Introduction
Special Characters
History
This brochure provides a brief introduction to
UNIX. A quick reference to commonly used
commands is listed on the reverse side of this
brochure. A few features to get you started with
UNIX are described below.
Special characters may be used in commands to
match existing file and directory names. The asterisk
( * ) is used to match an arbitrary string of characters.
For example,
% ls let*
will list all of your files in the current directory
beginning with let and
% ls *old
will list all files ending with old.
A question mark is used to match any single
character; for examle,
% ls ab?de
will match and list files named ab1de, abcde and
[Link], but will not match files named abde or
abccde.
The history command displays a numbered list
of the last twenty-five commands entered. You can
repeat a specififc numbered command in the list. For
example,
% !35
repeats the command numbered 35. Also, you can
repeat the last command that began with str by
typing the following:
% !str
You can repeat the last executed command in the list
by typing
% !!
Files and Directories
On UNIX, information is stored in files and
directories. Files have names, such as thesis or
report.nov19. Because UNIX uses special characters
for special purposes, it is best to use only letters
( A...Z, a...z ), digits ( 0...9 ), periods ( . ), and
underscores ( _ ) in file names.
Files are created by various UNIX commands.
You can save your mail messages in files. You can
also create text files with an editor.
Files are located in directories. Directories can
contain other directories, with are called
subdirectories. The directory containing a
subdirectory is known as the parent of the
subdirectory. Each account has a main directory
known as the home directory.
Commands
You can enter UNIX commands by typing the
command after a prompt such as % and then
pressing the Return key. For example, type
% ls
and then press the Return key. The ls command lists
the names of files in the current directory. The mkdir
command is used to create directories. For example,
% mkdir letters
creates a directory named letters.
Basic file manipulation commands include mv
for moving or renaming files, cp for copying files, lpr
for printing files, and rm for removing files. The cd
command is used to change from one directory to
another. For example, the command
% cd letters
moves you to the letters subdirectory, and
% cd
moves you to your home direcory.
Redirection
Commands normally display results on the
screen; this output may be redirected to a file by
using the redirection ( > ) symbol. For example, the
who command lists the current users on the system.
The command
% who > save_who
writes the output of who into the file save_who.
Redirection using > will not overwrite an existing
file. To do that, use >!:
% who >! save_who
To append to the end of an existing file, use two
redirection characters ( >> ) instead of one ( > ).
Output of one command may be used as input to
another command by using the pipe ( | ) symbol. For
example,
% who | wc l
shows how many users are logged in by usign wc l
to count the lines in the output of who.
For more information
Information about UNIX commands is available
via the man and apropos commands. Type
% apropos topic
to find manual entries relating to topic, and
% man command
to find the manual entry for command.
Many introductory books on UNIX are available
in bookstores and libraries.