Appendix C
Appendix C
Command Summary
The following is a list of the UNIX commands (utilities) in alphabetic order. The num-
bers after the commands are the page numbers. To refresh your memory, the command
line format is shown again in Figure C.1.
Figure C.1
The Command Line Format
$ command [ - options ] [ arguments ]
alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 299
This creates aliases for commands.
at . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
This command runs another command or a list of commands at a later time.
Option Operation
banner. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
This command displays its argument, the specified string, in large letters.
509
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 510
510 Appendix C
cal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Displays the calendar for a specified year or month of a year.
calendar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
This command is a reminder service and reads your schedule from the calendar file in the
current directory.
cd (change directory) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
This command changes your current directory to another directory.
chmod . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 365
This command changes the access permission of a specified file according to the option let-
ters indicating different categories of users. The user categories are u (for user/owner), g (for
group), o (for others), and a (for all). The access categories are r (for read), w (for write),
and x (for executable).
compress . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 487
This command is used to compress the specified file, thus reducing the size of the file and
saving space. The uncompress command is used to recover the original file and remove the
compressed file.
cp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
This command copies file(s) within the current directory or from one directory to another.
Option Operation
crypt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 478
This command is used to encrypt and decrypt a file. The command changes each character
in your file in a reversible way, so you can obtain the original file later.
cut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
This command is used to “cut out” specific columns or fields from a file.
Option Operation
date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Displays the day of the week, month, date, and time.
df . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 459
This command reports the total amount of the disk space or the space available on a
specified file system.
(dot) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 371
This command lets you run a process in the current shell environment and does not allow the
shell to create a child process to run the command.
du . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
This command summarizes the total space occupied by any directory, its subdirectories, or
each file.
Option Operation
512 Appendix C
echo. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269
This command displays (echoes) its arguments on the output device.
Escape
Character Meaning
exit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 370
This command terminates the current shell program whenever it is executed. It can also
return a status code (RC) to indicate the success or failure of a program. It also terminates
your login shell and logs you off if it is typed at the $ prompt.
export . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295
This command makes a specified list of variables available to other shells.
expr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
This command is a built-in operator for arithmetic operations. It provides arithmetic and
relational operators.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 513
find . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
This command locates files that match a given criterion in a hierarchy of directories. With
the action options, you can instruct UNIX about what to do with the files once they are
found.
finger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467
This command displays detailed information on users.
Option Operation
-b Suppresses displaying of the user’s HOME directory and shell in a long format dis-
play.
-f Suppresses displaying the header in a nonlong format output.
-h Suppresses displaying the .project file in a long format output.
-l Forces long format output.
-p Suppresses displaying the .plan file in a long format output.
-s Forces short format output.
FTP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
This command (utility) is used to transfer files from one system to another. Files of any type
can be transferred, and you can specify whether the file is an ASCII or a binary file. You
type ftp to start an FTP session.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 514
514 Appendix C
open remote-hostname Opens a connection to the FTP server on the specified host. It
prompts you to enter the user name and password to log in on the
remote host.
close Closes current open connection and returns to the local FTP
command. At this point you may issue the open command for a
different remote host.
quit (bye) Closes the current FTP session with the remote server and exits
ftp. That is, it returns to UNIX shell level.
? or help Displays an informative message about the meaning of the specified com-
mand. If no argument is given, a list of the known commands is displayed.
! Switches to escape shell mode.
hash Displays hash sign (#) as feedback for each data block transferred. The size of
a data block is 8192 bytes.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 515
Option Operation
-c --count Displays only the count of the matching lines in each file
that contains the match.
-i --ignore-case Ignores the distinction between lower and uppercase letters
in the search pattern.
-l --files-with-matches Displays the names of the files with one or more matching
lines, not the lines themselves.
-n --line-number Displays a line number before each output line.
-v --revert-match Displays only those lines that do not match the pattern.
--help Displays help page and exits.
--version Displays version information and exits.
head. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242
This command displays the first part of a specified file. This is a quick way to check the
contents of a file. The number of lines to be displayed is an option, and more than one file
can be specified on the command line.
Option Operation
help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Brings to the display a series of menus and questions that lead you to the descriptions of the
most commonly used UNIX commands.
516 Appendix C
kill . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
Terminates an unwanted or unruly process. You have to specify the process ID number. The
process ID0 kills all programs associated with your terminal.
learn. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
A computer-aided instruction program that is arranged in a series of courses and lessons.
It displays the menu of courses and lets you select your desired course and lesson.
let . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 396
This command provides arithmetic operations.
ln . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229
Creates links between an existing file and another filename or directory. It lets you have
more than one name for a file.
Option Operation
Option Operation
Option Operation
-d Prints the name of the system default printer for print requests.
ls (list) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
This command lists the contents of your current directory, or any directory you specify.
Option Operation
mailx . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
This utility provides the electronic mail system for the users. You can send messages to
other users on the system, regardless of whether they are logged on or not.
Option Operation
-f filename Reads mail from the specified filename instead of the system mailbox. If no
file is specified, it reads from mbox.
-H Displays a list of the message headers.
-s subject Sets the subject field to the string subject.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 518
518 Appendix C
Command Operation
Command Operation
man . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
This command shows pages from the online system documentation.
mesg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 320
This command is set to n to prohibit unwanted write messages. It is set to y to receive
messages.
Option Operation
520 Appendix C
more. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
Displays files one screen at a time. This is useful for reading large files.
Option Operation
mv . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
This command renames files or moves files from one location to another.
Option Operation
news . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321
This command is used to look at the latest news in the system. It is used by the system
administrator to inform others of the events happening.
Option Operation
-a Displays all the news items, whether they are in old or new files.
-n Lists only the names of the news files (headers).
-s Displays the number of the current news items.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 521
nohup. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 285
This prevents the termination of the background process when you log out.
passwd . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
This command changes your login password.
paste . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
This command is used to join files together line by line, or to create new files by pasting
together fields from two or more files.
Option Operation
pg . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
Displays files one screen at a time. You can enter the options or other commands when pg
shows the prompt sign.
Option Operation
522 Appendix C
Key Operation
pr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Your file is formatted before printing or viewing it on the screen.
Option Operation
+page --pages=page Starts displaying from the specified page. The de-
fault is page 1.
-columns --columns=columns Displays output in the specified number of
columns. The default is one column.
-a --across Displays output in columns across (rather than
down) the page, one line per column.
-d --double-space Displays output double spaced.
-hstring --header=string Replaces the filename in the header with the speci-
fied string.
-lnumber --length=number Sets the page length to the specified number of
lines. The default is 66 lines.
-m --merge Displays all the specified files in multiple columns.
-p Pauses at the end of each page and sounds the bell.
-character --separator=character Separates columns with a single specified
character. If character is not specified, then [Tab]
is used.
-t --omit-header Suppresses the five-line header and five-line trailer.
-wnumber --width=number Sets line width to the specified number of
characters. The default is 72.
--help Displays help page and exits.
--version Displays version information and exits.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 523
Option Operation
-a Displays the status of all the active processes, not just the user’s.
-f Displays a full list of information, including the full command line.
r (redo) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
This is a Korn shell command that repeats the last command or commands from the history
file.
read . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 372
This command reads input from the input device and stores the input string in one or more
variables specified as the command arguments.
Command Operation
rm (remove) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
This command removes (deletes) files from your current directory, or any other directory
you specify.
Option Operation
524 Appendix C
set . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274
Displays the environmental/shell variables on the output device. The command unset
removes the unwanted variables.
Option Operation
sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 283
This command causes the process to go to sleep (wait) for the specified time in seconds.
sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 290
Text file(s) are sorted in different orders.
Option Operation
spell . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
This command checks the spelling of a specified document or words entered from the
keyboard. It only displays the words not found in the spelling list and does not suggest a
correct spelling.
Option Operation
stty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417
This command sets options that control the capabilities of your terminal. There are more
than a hundred different settings, and the following table lists only some of the options.
Option Operation
echo [-echo] Echoes [does not echo] the typed characters; the default is echo.
raw [-raw] Disables [enables] the special meaning of the metacharacters; the default is
-raw.
intr Generates an interrupt signal; usually the [Del] key is used.
erase [Backspace]. Erases the preceding character; usually the # key is used.
kill Deletes the entire line; usually @ or [Ctrl-u] is used.
eof Generates the (end-of-file) signal from the terminal; usually [Ctrl-d] is used.
ek Resets the erase and kill keys to # and @, respectively.
sane Sets the terminal characteristics to sensible default values.
tail . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
This command displays the last part (tail end) of a specified file. This is a quick way to
check the contents of a file. The options give the flexibility to specify a desired part of
the file.
Option Operation
526 Appendix C
talk . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 323
This command is used for terminal-to-teminal communication. The receiving party must be
logged on.
tar . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
This command is used to copy a set of files into a single file, called a tarfile. A tarfile
is usually saved on a magnetic tape but it can be on any other media such as a floppy disk.
It packs multiple files into a single file (in tar-format) that can be unpacked later by tar.
Option Operation
tee . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
The output is split. One copy is displayed on your terminal, the output device, and another
copy is saved in a file.
Option Operation
telnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 488
This command allows you to log into a remote server using server resources such as such as
a scanner, CD storage devices, or a CD-writer. Also, it allows you to access your account on
a UNIX server from your system at home.
test . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
This command tests the condition of an expression given to it as an argument, and returns
true or false depending on the status of the expression. It gives you the capability of testing
different types of expressions.
AFZAMA03_0131194496.qxd 3/16/07 2:20 PM Page 527
time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
This command provides information about the computer time your command uses. It reports
the real time, user time, and system time required by a specified command.
tput . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
This command is used with the terminfo database, which contains codes for terminal
characteristics and facilitates the manipulation of your terminal characteristics such as
boldface text, clear screen, and so on.
Option Operation
trap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 416
This command sets and resets the interrupt signals. The following table shows some of the
signals you can use to control the termination of your program.
Signal
Number Name Meaning
528 Appendix C
type . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
This command gives more information about another command, such as whether the speci-
fied command is a shell command or a shell built-in command.
wall . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 322
This command is used mostly by the system administrator to warn users of some imminent
events.
wc . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
This command counts number of characters, words, or lines in the specified file.
Option Operation
who . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Lists the login name, terminal lines, and login times of the users who are on the system.
-q --count The quick who; just displays the name and number of users.
-H --heading Displays heading above each column.
-b Displays the time and date of the last reboot.
--help Displays a usage message.
write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
This command is used for terminal-to-terminal communication. The receiving party must be
logged on.