xref: /original-bsd/bin/ps/ps.1 (revision e61fc7ea)
1.\" Copyright (c) 1980, 1990 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" %sccs.include.redist.man%
5.\"
6.\"     @(#)ps.1	6.7 (Berkeley) 06/26/90
7.\"
8.Dd
9.Dd
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.
21Normally, only your processes are candidates to be printed by
22.Nm ps ;
23specifying
24.Fl a
25causes other users' processes to be candidates to be printed;
26specifying
27.Fl x
28includes processes without control terminals in the candidate pool.
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
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.
40The state is given by a sequence of letters, e.g. ``RWNA''.
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.
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
54and which is exceeding that limit shows >; such a process is (necessarily)
55not swapped.
56An additional letter may indicate whether a process is running with altered
57CPU scheduling priority (nice); if the process priority is reduced,
58an N is shown, if the process priority has been artificially raised then
59a `<' is shown.
60The final optional letter
61indicates any special treatment of the process for virtual
62memory replacement; the letters correspond to options to the
63.Xr vadvise  2
64call; currently the possibilities are A standing for VA_ANOM and
65S for VA_SEQL.
66An A typically represents a
67.Xr lisp  1
68in garbage collection, and S is typical of large image processing programs
69which are using virtual memory to sequentially address voluminous data.
70.Pp
71Here are the options:
72.Tp Fl a
73asks for information regarding processes associated with terminals (ordinarily
74only one's own processes are displayed).
75.Tp Fl c
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.
80.Tp Fl e
81Asks for the environment to be printed as well as the arguments to the command.
82.Tp Fl g
83Asks for all processes.
84Without this option,
85.Nm ps
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.
90.Tp Fl k
91causes the file
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
101WCHAN as described below.
102.Tp Fl n
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.
107.Tp Fl s
108Adds the size SSIZ of the kernel stack of each process (for use by system
109maintainers) to the basic output format.
110.Ct Fl t
111.Ar x
112.Cx
113Only output information on processes whose controlling tty is
114.Ar x
115(which should be specified as printed by
116.Nm ps ,
117e.g.
118.Ar t3
119for tty3,
120.Ar tco
121for console,
122.Ar td0
123for ttyd0,
124.Ar t ?
125for processes with no tty,
126.Ar t
127for processes at the current tty,
128etc).
129This option must be the last one given.
130.Tp Fl u
131A user oriented output is produced.
132This includes fields USER, %CPU, NICE, SIZE, and RSS as described below.
133.Tp Fl v
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.
137.Tp Fl w
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.
141.Tp Fl x
142asks even about processes with no terminal.
143.Tp Fl U
144causes ps to update a private database where it keeps system
145information.  Thus ``ps U'' should be included in the
146.Pa /etc/rc
147file.
148.Tp Fl #
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.
154.Tp
155.Pp
156A second argument is taken
157to be the file containing the system's
158namelist.  Otherwise, /vmunix is used.
159A third argument tells
160.Nm ps
161where to look for
162.Pa core
163if the
164.Fl k
165option is given, instead of
166.Pa /vmcore .
167If a fourth argument is given, it
168is taken to be the name of a swap file to use instead of
169the default
170.Pa /dev/drum .
171.Pp
172Fields which are not common to all output formats:
173.Pp
174.Dw PAGEIN
175.Dp Li USER
176name of the owner of the process
177.Dp Li %CPU
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%.
182.Dp Li NICE
183(or NI) process scheduling increment (see
184.Xr setpriority  2  )
185.Dp Li SIZE
186virtual size of the process (in 1024 byte units)
187.Dp Li RSS
188real memory (resident set) size of the process (in 1024 byte units)
189.Dp Li LIM
190soft limit on memory used, specified via a call to
191.Xr setrlimit  2  ;
192if no limit has been specified then shown as
193.Ar xx
194.Dp Li TSIZ
195size of text (shared program) image
196.Dp Li TRS
197size of resident (real memory) set of text
198.Dp Li %MEM
199percentage of real memory used by this process.
200.Dp Li RE
201residency time of the process (seconds in core)
202.Dp Li SL
203sleep time of the process (seconds blocked)
204.Dp Li PAGEIN
205number of disk i/o's resulting from references by the process
206to pages not loaded in core.
207.Dp Li UID
208process owner's user-id (numerical)
209.Dp Li PPID
210parent process id (numerical)
211.Dp Li CP
212short-term cpu utilization factor (used in scheduling)
213.Dp Li PRI
214process priority (non-positive when in non-interruptible wait)
215.Dp Li ADDR
216swap address of the process
217.Dp Li WCHAN
218address of event on which a process is waiting (an address in the system).
219A symbol is chosen that classifies the address, unless numerical
220output is requested (see the
221.Fl n
222flag).
223In this case, the initial part of the address is
224trimmed off and is printed hexadecimally, e.g., 0x80004000 prints as 4000.
225.Pp
226.Dp Li F
227flags associated with process as in
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.
260A process that has exited and has a parent that has not
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
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.
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.
299