sign inHome | Recent Changes | All Pages | HelpSearch:

Server ps command

The ps command

ps is a command that lists running processes. It has many options for what processes it displays, what, and how it displays information about those processes.


ps x -o pid,args --forest
  PID COMMAND
30279 -bash
 1548  _ ps x -o pid,args --forest
11298 lighttpd -f config/lighttpd.conf
11299  _ ruby /var/www/virtual/<my.domain>/typo/public/dispatch.fcgi
11300  _ ruby /var/www/virtual/<my.domain>/typo/public/dispatch.fcgi

This example lists all processes owned by the current user, displays the pid, and full arguments used to execute the process, in a format that sorts by process tree. So you can tell that both ruby processes were started by the lighttpd process. This example also demonstrates the use of BSD (x), POSIX (-o pid,args), and GNU (--forest) options all mixed together in one command. It is important to note that if it has a dash, and how many dashes is significant. Occasionally with or without a slash will work the same.

The first process at the top is the shell that ps was run from. The second one is ps itself which the display indicates is a subprocess of bash. “lighttpd” isn’t a subprocess of anything. It has detached which is normal for a server process. It is also visible from this view that both instances of ruby were started by the lighttpd process. So if the lighttpd process is killed then both ruby instances would also be killed, and conversely to start all three processes it is only neccisary to run the first command.

As usual to view the full ps manual, run the man command.


$ man ps

Powered by JunebugWiki v0.0.28 Last edited by hasan on November 27, 2007 05:18 PM (diff)
Version 4 (current) «olderversions