3BSD/usr/man/man1/ps.1

Compare this file to the similar file:
Show the results in this format:

.TH PS 1 11/13/79
.UC
.SH NAME
ps \- process status
.SH SYNOPSIS
.B ps
[
.B acgklrstuvwx#
[ namelist ] ]
.SH DESCRIPTION
.I Ps
prints certain indicia about active processes.
To get a complete printout on the console or lpr, use
``ps\ axlgw''
For a quick snapshot of system activity,
``ps\ au''
is recommended.
A minus may precede options with no effect.
The following options may be specified.
.IP a
asks for information about all processes with terminals (ordinarily
only one's own processes are displayed).
.IP c
causes only the
.I comm
field to be displayed instead of the arguments.
(The comm field is the tail of the path name of the file
the process last exec'ed.)
This option speeds up
.I ps
somewhat and reduces the amount of output.
It is also more reliable since the process can't scribble on top of it.
.IP g
Asks for all processes.
Without this option,
.I ps
only prints ``interesting'' processes.
Processes are deemed to be uninteresting if they are process group leaders,
or if their arguments begin with a `\-'.
This normally eliminates shells and getty processes.
.IP k
causes the file
.I /vmcore
is used in place of
.IR /dev/kmem " and " /dev/mem.
This is used for
postmortem system debugging.
.IP l
asks for a long listing.
The short listing contains the user name, process ID, tty,
the cumulative execution time of the process and an
approximation to the command line.
.IP r
asks for "raw output".
A non-human readable sequence of structures is output on the standard output.
There is one structure for each process, the format is defined by
<psout.h>
.IP s
Print the size of the kernel stack of each process.
This may only be used with the short listing, and is for use by
system developers.
.IP t\fIttyname\fP
restricts output to processes whose controlling tty is the
specified ttyname (which should be specified as printed by
.I ps,
e.g.
.I t3
for tty3,
.I tco
for console,
.I td0
for ttyd0,
.I t?
for processes with no tty,
etc).
This option must be the last one given.
.IP u
A user oriented output is produced.
This includes the
name of the owner of the process,
process id,
percent of the CPU recently used (not yet implemented),
nice value,
size,
resident set size,
tty,
cpu time used,
and the command.
.IP v
A version of the output containing virtual memory statistics is output.
Fields output are flags, process id, teletype, cpu time,
residency time, time sleeping, minor page faults, major page faults,
process virtual size,
resident set size,
size of resident set at last swap, 
text virtual size,
text resident set size, 
the average number of page faults per second over the last few seconds,
and the command.
Flags are R for running, S for sleeping, W for swapped, D for disk (i/o) wait,
and P for page wait.  Residency time is the length of time in core or on
disk; currently ``127'' is infinite.  Resident size is the number of
physical memory pages assigned.
.IP w
tells
.I ps
you are on a wide terminal (132 columns).
.I Ps
normally assumes
you are on an 80 column terminal.
This information is used to decide how much of long commands to print.
The
.B w
option may be repeated, e.g.
.B ww,
and the entire command, up to 128 characters, will be printed
without regard to terminal width.
.IP x
asks even about processes with no terminal.
.IP #
A process number may be given,
(indicated here by #),
in which case the output
is restricted to that process.
This option must also be last.
.PP
A second argument tells
.I ps
where to look for
.I core
if the
.I k
option is given, instead of /vmcore.
A third argument is the name of a swap file to use instead of
the default /dev/drum.
If a fourth argument is given,
it is taken to be the file containing the system's namelist.
Otherwise, "/vmunix" is used.
.PP
The output is sorted by tty, then by process ID.
.PP
The long listing is columnar and contains
.IP F
Flags associated with the process.
These are defined by #define lines in /usr/include/sys/proc.h.
.IP S
The state of the process.
0: nonexistent;
S: sleeping;
W: waiting;
R: running;
I: intermediate;
Z: terminated;
T: stopped.
.IP UID
The user id of the process owner.
.IP PID
The process ID of the process; as in certain cults it is possible to kill a process
if you know its true name.
.IP PPID
The process ID of the parent process.
.IP CPU
Processor utilization for scheduling.
.IP PRI
The priority of the
process; high numbers mean low priority.
.IP NICE
Used in priority computation.
.IP ADDR
The memory address of the process if resident,
otherwise the disk address.
.IP SZ
The size in blocks of the memory image of the process.
.IP RSS
The size of the resident set (set of pages that the process can
access without faulting) of the process.
.IP WCHAN
The event for which the process is waiting or sleeping;
if blank, the process is running.
.IP TTY
The controlling tty for the process.
.IP TIME
The cumulative execution time for the process.
.IP COMMAND
The command and its arguments.
.DT
.PP
A process that has exited and has a parent, but has not
yet been waited for by the parent is marked <defunct>.
.I Ps
makes an educated guess as to the file name
and arguments given when the process was created
by examining memory or the swap area.
The method is inherently somewhat unreliable and in any event
a process is entitled to destroy this information,
so the names cannot be counted on too much.
.SH FILES
.ta \w'/usr/sys/core 'u
/vmunix	system namelist
.br
/dev/kmem	kernel memory
.br
/dev/drum	swap device
.br
/vmcore	core file
.br
/dev	searched to find swap device and tty names
.SH "SEE ALSO"
kill(1), w(1)
.SH BUGS
Things can change while
.I ps
is running; the picture it gives is only a close
approximation to reality.
...br
..Some data printed for defunct processes is irrelevant.
.PP
Some processes, typically those in the background, are
printed with null or garbaged arguments, even though
the process has not swapped.
(Sometimes ps even loses on its own arguments!)
In these cases, the name of the command is printed in parentheses.