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