Datasheet

Book VIII
Chapter 1
. . . And UNIX
Lurks Beneath
653
Useful Commands
in Figure 1-6. These activities are called processes; some are created when
you launch applications, and others are simply tasks that Mac OS X has to
take care of to keep things running smoothly.
Figure 1-6:
The
top
command
displays
all running
processes.
Besides listing the names of the various processes currently in use, top tells
you how much of your CPU is being devoted to each process. This lets you
know what process is currently hogging all your computing power.
Sometimes a process stalls, effectively freezing that action. By using the top
command to find the Process ID (PID) of the offending process, you can halt
the process. Simply use the kill command followed by the PID of the process
that you want to stop. (The man help page for the kill command gives
more options that may help terminate stubborn processes with prejudice.)
Do not go killing processes with a cavalier attitude! Although Mac OS X is
extremely stable, removing the wrong process — such as init or mach_
init — is rather like removing a leg from one of those deep-sea drilling
platforms: the very definition of Not Good. You could lock up your system
and lose whatever you’re doing in other applications. If you simply want
to shut down a misbehaving program, go graphical again (at least for a
moment) and use the Force Quit menu command from the Finder menu.
Like top, another handy command for examining process info is ps (short
for process). Most often, you’ll want to append a few flags to the ps command
to get the information that you desire. For example, try the following
command:
54_435410-bk08ch01.indd 65354_435410-bk08ch01.indd 653 8/6/09 12:45:00 AM8/6/09 12:45:00 AM