PS(1)

NAME
ps - report process status

SYNOPSIS
ps [-][lujsvmaxScewhrnu][txx]

DESCRIPTION
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.

COMMAND-LINE OPTIONS
Command line arguments may optionally be preceeded by a '-', but there is no need for it. There are also some "long options" in GNU style; see below for those.

l   long format

u   user format: gives user name and start time

j   jobs format: pgid sid

s   signal format

v   vm format

m   displays memory info (combine with p flag to get number of pages).

a   show processes of other users too

x   show processes without controlling terminal

S   add child cpu time and page faults

c   command name from task_struct

e   show environment

w   wide output: don't truncate command lines to fit on one line.

h   no header

r   running procs only

n   numeric output for USER and WCHAN.

txx only procs with controlling tty xx, use for xx the same letters as shown in TT field. tty name or pid must be given after the last option, with no space between options and pid or tty.

LONG COMMAND-LINE OPTIONS
These options are preceeded by a double-hyphen.

--sort:key[,key[,...]]
    Choose the sort key. Any character can be used in place of the :, the GNU project uses =. Rather than try to explain all the sort keys here and try to keep the man page up to date, please see the next option:

--help
    Get a help message that summarizes the usage and gives a list of supported keys.

FIELD DESCRIPTIONS

PRI This is the counter field in the task struct. It is the time in HZ of the process's possible timeslice.

NI  Standard unix nice value, a positive value means less cpu time.

SIZE
    virtual image size, size of text+data+stack

RSS resident set size, kilobytes of program in memory.

WCHAN
    name of the kernel function where the process is sleeping. This does not work, because namelist functionality has not been added to ps yet.

STAT

R   runnable

S   sleeping

D   uninterruptible sleep

T   stopped or traced

Z   zombie

W   process has no resident pages

TT  controlling tty

PAGEIN
    number of major page faults, that is, page faults that cause pages to be read from disk.

TRS text resident size

SWAP
    kilobytes (with -p pages) on swap device

SHARE
    shared memory

UPDATING
ps 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 anything else to run. Do not give this ps any special permissions.

You will need to update the /etc/psdatabase file by running a special suid program called /etc/psupdate to get meaningful information from the WCHAN field.

NOTES
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.

WCHAN (l format) shows the function in which the process is sleeping, with the 'sys_' part is stripped from function names. If /etc/psdatabase does not exist, it is just a hex number instead.

%CPU (u format) shows the cputime/realtime percentage.

PAGEIN (v format): pages read from the buffer cache are counted as major page faults.

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).

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

BUGS
Tty names are hard coded: virtual consoles are a1, a2, ... serial lines are A0 and A1, pty's are p0, p1 ...

AUTHOR
ps was originally written by Branko Lankester (lankeste@fwi.uva.nl) Michael K. Johnson (johnsonm@sunsite.unc.edu) re-wrote it significantly to use the proc filesystem, changing a few things in the process.