Datasheet
Book VIII
Chapter 1
. . . And UNIX Lurks
Beneath
689
Useful Commands
Processes
Have you ever been curious as to why your hard drive seems to spin and
grind on occasion while your system is seemingly inactive? Mac OS X some-
times has a lot of stuff going on behind the scenes. To discover just what
your computer is busy doing at any time, use the top command to display
all the actions that your computer is currently performing, as shown 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 pro-
cess 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 plat-
forms: 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 Apple menu.
55_9781118022061-bk08ch01.indd 68955_9781118022061-bk08ch01.indd 689 8/10/11 9:39 AM8/10/11 9:39 AM