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