next up previous contents
Next: 1.4.18 rm Up: 1.4 Man Pages Previous: 1.4.16 mv   Contents

1.4.17 ps

ps - report process status

ps [-] [lujsvmaxScewhrnu] [txx] [O[+|-]k1[[+|-]k2...]] [pids] there are also three long options:

More long options are on the way...

ps gives a snapshot of the current processes. If you want a repetitive update of this status, use top. This man page documents the /proc-based version of ps, or tries to.

The command-line options for this version of ps are derived from the BSD version of ps, not the System V version. The command-line arguments should not be preceded by a `-' character, because in the future, a `-' will be used to indicate Unix98-standard command-line arguments, while no `-' will indicate the current ``extended BSD'' style of command line arguments.

For now, ps will give you a warning if you use a `-' for a short option, but it will still work. If you have shell scripts which use BSD-style arguments to ps, take heed of the warning and fix them, or else your scripts will fail to function correctly at some point in the future.

If you want to turn off the warnings, set the I_WANT_A_BROKEN_PS environment variable.

There are also some ``long options'' in GNU style; see below for those.

long format
user format: gives user name and start time
jobs format: pgid sid
signal format
vm format
displays memory info (combine with p flag to get number of pages).
"forest" family tree format for command line a show processes of other users too
show processes without controlling terminal
add child cpu time and page faults
command name from task_struct
show environment after command line and ` + '
wide output: don't truncate command lines to fit on one line. To be exact, every w that is specified will add another possible line to the output. If the space isn't needed it isn't used. You may up to 100 w's. h no header r running procs only n numeric output for USER and WCHAN.
only procs with controlling tty xx; for xx you may use either the name of a device file under "/dev" or that name with either tty or cu sliced off. This is the reverse heuristic that ps uses to print out the abbreviated tty name in the TT field, e.g. ps -t1.
Order the process listing according to the multilevel sort specified by the sequence of short keys from SORT KEYS, k1, k2, ... Default order specifications exist for each of the various formats of ps. These are over-ridden by a user specified ordering. The `+' is quite optional, merely re-iterating the default direction on a key. `-' reverses direction only on the key it precedes.
As with t and pids, the O option must be the last option in a single command argument, but specifications in successive arguments are catenated.
List only the specified processes; they are comma- delimited. The list must be given immediately after the last option in a single command-line argument, with no intervening space, e.g. ps -j1,4,5. Lists specified in subsequent arguments are catenated, e.g. ps -l 1,2 3,4 5 6 will list all of the processes 1-6 in long format. If pids are given, they are listed no matter what. If a tty is given matching processes are listed no matter what. These two features override the 'a' and 'x' flags.
These options are preceded by a double-hyphen.

Choose a multi-letter key from the SORT KEYS section. X may be any convenient separator character. To be GNU-ish use `='. The `+' is really optional since default direction is increasing numerical or lexicographic order. E.g.:
ps -jax -sort=uid,-ppid,+pid
Get a help message that summarizes the usage and gives a list of supported sort keys. This list may be more up to date than this man page.
Display version and source of this program.
Note that the values used in sorting are the internal values ps uses and not the `cooked' values used in some of the output format fields.

cmd simple name of executable
cmdline full command line
flags flags as in long format F field
pgrp process group ID
tpgid controlling tty process group ID
cutime cumulative user time
cstime cumulative system time
utime user time
stime system time
min_flt number of minor page faults
maj_flt number of major page faults
cmin_flt cumulative minor page faults
cmaj_flt cumulative major page faults
session session ID
pid process ID
ppid parent process ID
rss resident set size
resident resident pages
size memory size in kilobytes
share amount of shared pages
tty the minor device number of tty
start_time time process was started
uid user ID number
user user name
vsize total VM size in bytes
priority kernel scheduling priority
This is the counter field in the task struct. It is the time in HZ of the process's possible timeslice.
Standard unix nice value; a positive value means less cpu time.
Virtual image size; size of text+data+stack.
Resident set size; kilobytes of program in memory.
Name of the kernel function where the process is sleeping, with the `sys_' stripped from the function name. If /etc/psdatabase does not exist, it is just a hex number instead.
Information about the status of the process. The first field is R for runnable, S for sleeping, D for uninterruptible sleep, T for stopped or traced, or Z for a zombie process. The second field contains W if the process has no resident pages. The third field is N if the process has a positive nice value (NI field).
Controlling tty.
Number of major page faults (page faults that cause pages to be read from disk, including pages read from the buffer cache).
Text resident size.
Kilobytes (or pages if -p is used) on swap device.
Shared memory.
This proc-based ps works by reading the files in the proc filesystem, mounted on /proc. This ps does not need to be suid kmem or have any privileges to run. Do not give this ps any special permissions.
You will need to update the /etc/psdatabase file by running /usr/sbin/psupdateto get meaningful information from the WCHAN field. This should be done every time you compile a new kernel. You should also run 'ps' as root once and then any time the tty devices in the "/dev" directory change.
As of procps-1.00, ps/top read directly if it is available. The search path for kernel address-to-symbol resolution is:

The member used_math of task_struct is not shown, since crt0.s checks to see if math is present. This causes the math flag to be set for all processes, and so it is worthless.

Programs swapped out to disk will be shown without command line arguments, and unless the c option is given, in parentheses.

%CPU shows the cputime/realtime percentage. It will not add up to 100% unless you are lucky. It is time used divided by the time the process has been running.

The SIZE and RSS fields don't count the page tables and the task_struct of a proc; this is at least 12k of memory that is always resident. SIZE is the virtual size of the proc (code+data+stack).

To perform the device number to name mapping ps maintains a file called "/etc/psdevtab" (updated whenever "/dev" becomes newer and permissions allow update). If permissions do not allow update, every invokation of ps requires a stat(2) of every file in the "/dev" directory. If "/dev" entries change often on your system, you should run ps as root often. I may add a fallback file under $HOME under force of popular demand.

ps was originally written by Branko Lankester <>. Michael K. Johnson <johnsonm@red-> re-wrote it significantly to use the proc filesystem, changing a few things in the process. Michael Shields <> added the pid-list feature. Charles Blake <> added multi-level sorting, the dirent-style library, the device name-to-num- ber mmaped database, the approximate binary search directly on, and many code and documentation cleanups. David Mossberger-Tang wrote the generic BFD support for psupdate. Michael K. Johnson <johnsonm@red-> is the current maintainer.

Please send bug reports to <>

joe@localhost $ ps


3485 1 S 0:00 xterm -sb

3509 p1 S 0:00 -bash

16910 2 S 0:00 /sbin/mingetty tty2

17024 p4 S 0:00 -bash

17076 3 S 0:00 (mingetty)

17077 4 S 0:00 (mingetty)

17078 5 S 0:00 (mingetty)

17079 6 S 0:00 (mingetty)

17647 p4 R 0:00 ps

next up previous contents
Next: 1.4.18 rm Up: 1.4 Man Pages Previous: 1.4.16 mv   Contents