ps - It does one thing and it does it many different ways.
ps command on Linux/Unix systems (and, yes, that includes Mac OS X) is a command-line utility for displaying information about currently running processes.
Unix has had the
ps command for decades, but because Unix has a varied past with contributions from different parties, there are a couple of different camps on
ps. It basically boils down to the System V camp and the BSD camp. Fortunately for users of operating systems such as Linux that use GNU libraries, the
ps installed provides the options of both the System V and BSD versions.
* The way most people use
Most people use
ps one of the following ways:
The first is a common System V way of listing all processes. The latter is a BSD way.
* Show parent-child relationships *
f option is really handy for showing parent-child process relationships. It produces a tree-like structure.
Here is an excerpt of the output of
ps -ef f:
UID PID PPID C STIME TTY STAT TIME CMD root 2617 1 0 2010 ? Ss 9:38 /usr/sbin/sshd root 12502 2617 0 19:52 ? Ss 0:00 \_ sshd: fozz [priv] fozz 12504 12502 0 19:52 ? S 0:04 \_ sshd: fozz@pts/0 fozz 12505 12504 0 19:52 pts/0 Rs 0:00 \_ -zsh fozz 14877 12505 0 20:08 pts/0 R+ 0:00 \_ ps -ef f fozz 14878 12505 0 20:08 pts/0 R+ 0:00 \_ [less]