dynamic allocation of tty slots; save tty hash structure (from ks@purdue)
[unix-history] / usr / src / bin / ps / ps.1
CommitLineData
24115aa8
KM
1.\" Copyright (c) 1980 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
9a22b5c6 5.\" @(#)ps.1 6.1 (Berkeley) %G%
24115aa8 6.\"
9a22b5c6 7.TH PS 1 ""
24115aa8
KM
8.UC 4
9.SH NAME
10ps \- process status
11.SH SYNOPSIS
12.B ps
13[
9a22b5c6 14.B acegklstuvwxU#
24115aa8
KM
15]
16.SH DESCRIPTION
17.I Ps
18prints information about processes.
19Normally, only your processes are candidates to be printed by
20.I ps;
21specifying
22.B a
23causes other users processes to be candidates to be printed;
24specifying
25.B x
26includes processes without control terminals in the candidate pool.
27.PP
28All output formats include, for each process, the process id PID,
29control terminal of the process TT, cpu time used by the process TIME
30(this includes both user and system time), the state STAT of the process,
31and an indication of the COMMAND which is running.
32The state is given by a sequence of four letters, e.g. ``RWNA''.
33The first letter indicates the runnability of the process:
34R for runnable processes,
35T for stopped processes,
36P for processes in page wait,
37D for those in disk (or other short term) waits,
38S for those sleeping for less than about 20 seconds,
39and I for idle (sleeping longer than about 20 seconds)
40processes.
41The second letter indicates whether a process is swapped out,
42showing W if it is, or a blank if it is loaded (in-core);
43a process which has specified a soft limit on memory requirements
44and which is exceeding that limit shows >; such a process is (necessarily)
45not swapped.
46The third letter indicates whether a process is running with altered
dee48434
KM
47CPU scheduling priority (nice); if the process priority is reduced,
48an N is shown, if the process priority has been artificially raised then
49a `<' is shown; processes running without special treatment have just a
24115aa8
KM
50blank.
51The final letter indicates any special treatment of the process for virtual
52memory replacement; the letters correspond to options to the
53.IR vadvise (2)
54call; currently the possibilities are A standing for VA_ANOM,
55S for VA_SEQL and blank for VA_NORM; an A typically represents a
56.IR lisp (1)
57in garbage collection, S is typical of large image processing programs
58which are using virtual memory to sequentially address voluminous data.
59.PP
60Here are the options:
61.TP 5
62.B a
63asks for information about all processes with terminals (ordinarily
64only one's own processes are displayed).
65.TP 5
66.B c
67prints the command name, as stored internally in the system for purposes
68of accounting, rather than the command arguments, which are kept
69in the process' address space. This is more reliable, if less informative,
70since the process is free to destroy the latter information.
71.TP 5
72.B e
73Asks for the environment to be printed as well as the arguments to the command.
74.TP 5
75.B g
76Asks for all processes.
77Without this option,
78.I ps
79only prints ``interesting'' processes.
80Processes are deemed to be uninteresting if they are process group leaders.
81This normally eliminates top-level command interpreters and processes
82waiting for users to login on free terminals.
83.TP 5
84.B k
85causes the file
86.I /vmcore
87is used in place of
88.IR /dev/kmem " and " /dev/mem.
89This is used for
90postmortem system debugging.
91.TP 5
92.B l
93asks for a long listing, with fields PPID, CP, PRI, NI, ADDR, SIZE, RSS and
94WCHAN as described below.
95.TP 5
96.B s
97Adds the size SSIZ of the kernel stack of each process (for use by system
98maintainers) to the basic output format.
99.TP 5
100\fBt\fIx\fR
101restricts output to processes whose controlling tty is \fIx\fR
102(which should be specified as printed by
103.I ps,
104e.g.
105.I t3
106for tty3,
107.I tco
108for console,
109.I td0
110for ttyd0,
111.I t?
112for processes with no tty,
dee48434
KM
113.I t
114for processes at the current tty,
24115aa8
KM
115etc).
116This option must be the last one given.
117.TP 5
118.B u
119A user oriented output is produced.
120This includes fields USER, %CPU, NICE, SIZE, and RSS as described below.
121.TP 5
122.B v
123A version of the output containing virtual memory statistics is output.
124This includes fields RE, SL, PAGEIN, SIZE, RSS, LIM, TSIZ, TRS, %CPU
125and %MEM, described below.
126.TP 5
127.B w
128Use a wide output format (132 columns rather than 80); if repeated,
129e.g. ww, use arbitrarily wide output.
130This information is used to decide how much of long commands to print.
131.TP 5
132.B x
133asks even about processes with no terminal.
9a22b5c6
KM
134.TP
135.B U
136causes ps to update a private database where is keeps system
137information. Thus ``ps U'' should be included in the /etc/rc file.
24115aa8
KM
138.TP 5
139.B #
140A process number may be given,
141(indicated here by #),
142in which case the output
143is restricted to that process.
144This option must also be last.
145.PP
dee48434
KM
146A second argument is taken
147to be the file containing the system's
148namelist. Otherwise, /vmunix is used.
149A third argument tells
24115aa8
KM
150.I ps
151where to look for
152.I core
153if the
154.B k
155option is given, instead of /vmcore.
dee48434
KM
156If a fourth argument is given, it
157is taken to be the name of a swap file to use instead of
24115aa8 158the default /dev/drum.
24115aa8
KM
159.PP
160Fields which are not common to all output formats:
161.PD 0
162.IP USER 10
163name of the owner of the process
164.IP %CPU 10
165cpu utilization of the process; this is a decaying average over up to
166a minute of previous (real) time. Since the time base over which this
167is computed varies (since processes may be very young) it is possible
168for the sum of all %CPU fields to exceed 100%.
169.IP NICE 10
170(or NI) process scheduling increment (see
dee48434 171.IR setpriority (2))
24115aa8
KM
172.IP SIZE 10
173virtual size of the process (in 1024 byte units)
174.IP RSS 10
175real memory (resident set) size of the process (in 1024 byte units)
176.IP LIM 10
177soft limit on memory used, specified via a call to
dee48434 178.IR setrlimit (2);
24115aa8
KM
179if no limit has been specified then shown as \fIxx\fR
180.IP TSIZ 10
181size of text (shared program) image
182.IP TRS 10
183size of resident (real memory) set of text
184.IP %MEM 10
185percentage of real memory used by this process.
186.IP RE 10
187residency time of the process (seconds in core)
188.IP SL 10
189sleep time of the process (seconds blocked)
190.IP PAGEIN 10
191number of disk i/o's resulting from references by the process
192to pages not loaded in core.
193.IP UID 10
194numerical user-id of process owner
195.IP PPID 10
196numerical id of parent of process
197.IP CP 10
198short-term cpu utilization factor (used in scheduling)
199.IP PRI 10
200process priority (non-positive when in non-interruptible wait)
201.IP ADDR 10
202swap address of the process
203.IP WCHAN 10
204event on which process is waiting (an address in the system), with
205the initial part of the address trimmed off e.g. 80004000 prints
206as 4000.
207.sp
208.IP F 10
dee48434
KM
209flags associated with process as in
210.RI < sys/proc.h >:
24115aa8
KM
211.br
212.PP
213.sp
214.nf
215.ta 6n 18n 26n
216 SLOAD 000001 in core
217 SSYS 000002 swapper or pager process
218 SLOCK 000004 process being swapped out
219 SSWAP 000008 save area flag
220 STRC 000010 process is being traced
221 SWTED 000020 another tracing flag
222 SULOCK 000040 user settable lock in core
223 SPAGE 000080 process in page wait state
224 SKEEP 000100 another flag to prevent swap out
225 SDLYU 000200 delayed unlock of pages
226 SWEXIT 000400 working on exiting
227 SPHYSIO 000800 doing physical i/o (bio.c)
228 SVFORK 001000 process resulted from vfork()
229 SVFDONE 002000 another vfork flag
230 SNOVM 004000 no vm, parent in a vfork()
dee48434 231 SPAGI 008000 init data space on demand from inode
24115aa8
KM
232 SANOM 010000 system detected anomalous vm behavior
233 SUANOM 020000 user warned of anomalous vm behavior
234 STIMO 040000 timing out during sleep
235 SDETACH 080000 detached inherited by init
dee48434 236 SOUSIG 100000 using old signal mechanism
24115aa8
KM
237.fi
238.PD
239.PP
240A process that has exited and has a parent, but has not
241yet been waited for by the parent is marked <defunct>; a process
242which is blocked trying to exit is marked <exiting>;
243.I Ps
244makes an educated guess as to the file name
245and arguments given when the process was created
246by examining memory or the swap area.
247The method is inherently somewhat unreliable and in any event
248a process is entitled to destroy this information,
249so the names cannot be counted on too much.
250.SH FILES
9a22b5c6 251.ta \w'/etc/psdatabase 'u
24115aa8
KM
252/vmunix system namelist
253.br
254/dev/kmem kernel memory
255.br
256/dev/drum swap device
257.br
258/vmcore core file
259.br
260/dev searched to find swap device and tty names
9a22b5c6
KM
261.br
262/etc/psdatabase system namelist and device information
24115aa8
KM
263.SH "SEE ALSO"
264kill(1), w(1)
265.SH BUGS
266Things can change while
267.I ps
268is running; the picture it gives is only a close
269approximation to reality.