Datasheet

644
UNIX Commands 101
Figure 1-2:
Drag a
file from
a Finder
window into
Terminal to
display its
path.
You can even use the mouse while entering commands in the Terminal. Click
and drag your mouse over text to select it. From there, you can copy to the
Clipboard as you might expect with any other application.
UNIX Commands 101
To use the command line effectively, familiarize yourself with the commands
that are available to you. After all, how can you use a tool without knowing
what it can do? Despite having to memorize a few commands, UNIX usually
makes it easy on you by abbreviating commands, by following a standard
grammar (so to speak), and by providing you with extensive documentation
for each command.
Anatomy of a UNIX command
UNIX commands can perform many amazing feats. Despite their vast
abilities, all commands follow a similar structure:
command <optional flag(s)> <optional operand(s)>
The simplest form of a UNIX command is the command itself. (For a basic
discussion on UNIX commands such as ls, see the earlier section, “A few
commands to get started.”) You can expand your use of the ls command by
appending various flags, which are settings that enable or disable optional
features for the command. Most flags are preceded by a dash (-) and always
follow the command. For instance, you can display the contents of a directory
as a column of names by tacking on a -l flag to the ls command.
ls –l
54_435410-bk08ch01.indd 64454_435410-bk08ch01.indd 644 8/6/09 12:44:58 AM8/6/09 12:44:58 AM