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