Datasheet

654
UNIX Cadillac Commands
ps –aux
The man page for ps explains what each flag means. (Read more about using
the man command in the earlier section “Help is on the way!”)
UNIX Cadillac Commands
Besides working with files and processes, the command line has all kinds
of sophisticated commands. For example, with the command line, you have
instant access to a variety of tools for finding files or even stringing together
commands.
Finding files
The command line gives you a number of ways to search for files on your
hard drive. The two most commonly used commands are find and locate.
To use find, specify a starting point for the search followed by the name of
the file or folder that you want to find. For example, to find the Fonts folder
that belongs to your user, enter the command like this:
find ~/ -name “Fonts”
You should see at least one result of the find command.
/Users/markchambers//Library/Fonts
One great feature of the find command is that you can look for a file or
folder in more than one location. Suppose you want to find a file named
MyDocument that you know resides either in your Documents folder or on
your Desktop. For this kind of search, use the find command like this:
find ~/Documents ~/Desktop -name “MyDocument”
In this example, you are telling the find command which folders it should
search when looking for the file named MyDocument.
Using pipes
Nearly all UNIX commands can take on greater abilities by using a construct
called the pipe. A pipe (|) is represented by that funny little vertical line that
shows up when you press Shift+\. The pipe routes data from one command
to another one that follows — for example, many UNIX commands produce
large amounts of information that can’t all fit on one page. (You might have
noticed this behavior when you used the locate command.) Joining two
commands or functions together with the pipe command is piping. To tame
the screens full of text, pipe the find function to the less command. The
less command provides data one page at a time.
54_435410-bk08ch01.indd 65454_435410-bk08ch01.indd 654 8/6/09 12:45:00 AM8/6/09 12:45:00 AM