Working with Processes

The ps command (short for process status) outputs information about the various processes on your system. However, if you just execute ps by itself on the command line, you’ll see only the process information about the shell process you are running. For information about all the processes that belong to you, use the ps -x command, as shown in Example 12-14.

Example 12-14. Listing all the processes that belong to a user

$ ps -x
  PID  TT  STAT      TIME COMMAND
   71  ??  Ss     0:23.61 /System/Library/Frameworks/ApplicationServices.framework/
   72  ??  Ss     0:13.62 /System/Library/CoreServices/loginwindow.app/Contents/Mac
  131  ??  Ss     0:00.44 /System/Library/CoreServices/pbs
  138  ??  S      0:42.75 /System/Library/CoreServices/Dock.app/Contents/MacOS/Dock
  139  ??  S      0:40.96 /System/Library/CoreServices/SystemUIServer.app/Contents/
  145  ??  Ss     0:36.46 /System/Library/CoreServices/MirrorAgent.app/Contents/Mac
  147  ??  Ss     0:00.36 /System/Library/PrivateFrameworks/DMNotification.framewor
  157  ??  S      0:53.75 /Users/jldera/Library/PreferencePanes/Growl.prefPane/Cont
  159  ??  S      0:00.55 /Applications/iTunes.app/Contents/Resources/iTunesHelper.
  160  ??  S      0:01.02 /Applications/iCal.app/Contents/Resources/iCalAlarmSchedu
  161  ??  S      0:32.99 /Applications/iCal.app/Contents/MacOS/iCal -psn_0_1572865

When combined with grep, you’ll find that ps is just the process you are looking for. Example 12-15 shows a command to return the process information for Safari.

Example 12-15. Looking for Safari using ps and grep

$ ps -x | ...

Get Running Mac OS X Tiger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.