Commit | Line | Data |
---|---|---|
b6154e5c WJ |
1 | .\" Copyright (c) 1980, 1990, 1991 The Regents of the University of California. |
2 | .\" All rights reserved. | |
3 | .\" | |
4 | .\" Redistribution and use in source and binary forms, with or without | |
5 | .\" modification, are permitted provided that the following conditions | |
6 | .\" are met: | |
7 | .\" 1. Redistributions of source code must retain the above copyright | |
8 | .\" notice, this list of conditions and the following disclaimer. | |
9 | .\" 2. Redistributions in binary form must reproduce the above copyright | |
10 | .\" notice, this list of conditions and the following disclaimer in the | |
11 | .\" documentation and/or other materials provided with the distribution. | |
12 | .\" 3. All advertising materials mentioning features or use of this software | |
13 | .\" must display the following acknowledgement: | |
14 | .\" This product includes software developed by the University of | |
15 | .\" California, Berkeley and its contributors. | |
16 | .\" 4. Neither the name of the University nor the names of its contributors | |
17 | .\" may be used to endorse or promote products derived from this software | |
18 | .\" without specific prior written permission. | |
19 | .\" | |
20 | .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
21 | .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
22 | .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
23 | .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
24 | .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
25 | .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
26 | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
27 | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
28 | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
29 | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
30 | .\" SUCH DAMAGE. | |
31 | .\" | |
32 | .\" @(#)ps.1 6.17 (Berkeley) 6/20/91 | |
33 | .\" | |
34 | .Dd June 20, 1991 | |
35 | .Dt PS 1 | |
36 | .Os BSD 4 | |
37 | .Sh NAME | |
38 | .Nm \&ps | |
39 | .Nd process status | |
40 | .Sh SYNOPSIS | |
41 | .Nm \&ps | |
42 | .Op Fl aChjlmrSTuvwx | |
43 | .Op Fl M Ar core | |
44 | .Op Fl N Ar system | |
45 | .Op Fl O Ar fmt | |
46 | .Op Fl o Ar fmt | |
47 | .Op Fl p Ar pid | |
48 | .Op Fl t Ar tty | |
49 | .Op Fl W Ar swap | |
50 | .Nm ps | |
51 | .Op Fl L | |
52 | .Sh DESCRIPTION | |
53 | .Nm \&Ps | |
54 | displays a header line followed by lines containing information about your | |
55 | processes that have controlling terminals. | |
56 | This information is sorted by process | |
57 | .Tn ID . | |
58 | .Pp | |
59 | The information displayed is selected based on a set of keywords (see the | |
60 | .Fl L | |
61 | .Fl O | |
62 | and | |
63 | .Fl o | |
64 | options). | |
65 | The default output format includes, for each process, the process' | |
66 | .Tn ID , | |
67 | controlling terminal, cpu time (including both user and system time), | |
68 | state, and associated command. | |
69 | .Pp | |
70 | The options are as follows: | |
71 | .Bl -tag -width indent | |
72 | .It Fl a | |
73 | Display information about other users' processes as well as your own. | |
74 | .It Fl C | |
75 | Change the way the cpu percentage is calculated by using a ``raw'' | |
76 | cpu calculation that ignores ``resident'' time (this normally has | |
77 | no effect). | |
78 | .It Fl h | |
79 | Repeat the information header as often as necessary to guarantee one | |
80 | header per page of information. | |
81 | .It Fl j | |
82 | Print information associated with the following keywords: | |
83 | user, pid, ppid, pgid, sess, jobc, state, tt, time and command. | |
84 | .It Fl L | |
85 | List the set of available keywords. | |
86 | .It Fl l | |
87 | Display information associated with the following keywords: | |
88 | uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time | |
89 | and command. | |
90 | .It Fl M | |
91 | Extract values associated with the name list from the specified core | |
92 | instead of the default | |
93 | .Dq Pa /dev/kmem . | |
94 | .It Fl m | |
95 | Sort by memory usage, instead of by process | |
96 | .Tn ID . | |
97 | .It Fl N | |
98 | Extract the name list from the specified system instead of the default | |
99 | .Dq Pa /vmunix . | |
100 | .It Fl O | |
101 | Add the information associated with the space or comma separated list | |
102 | of keywords specifed, after the process | |
103 | .Tn ID , | |
104 | in the default information | |
105 | display. | |
106 | Keywords may be appended with an equals (``='') sign and a string. | |
107 | This causes the printed header to use the specified string instead of | |
108 | the standard header. | |
109 | .It Fl o | |
110 | Display information associated with the space or comma separated list | |
111 | of keywords specifed. | |
112 | Keywords may be appended with an equals (``='') sign and a string. | |
113 | This causes the printed header to use the specified string instead of | |
114 | the standard header. | |
115 | .It Fl p | |
116 | Display information associated with the specified process | |
117 | .Tn ID . | |
118 | .It Fl r | |
119 | Sort by current cpu usage, instead of by process | |
120 | .Tn ID . | |
121 | .It Fl S | |
122 | Change the way the process time is calculated by summing all exited | |
123 | children to their parent process. | |
124 | .It Fl T | |
125 | Display information about processes attached to the device associated | |
126 | with the standard input. | |
127 | .It Fl t | |
128 | Display information about processes attached to the specified terminal | |
129 | device. | |
130 | .It Fl u | |
131 | Display information associated with the following keywords: | |
132 | user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command. | |
133 | The | |
134 | .Fl u | |
135 | option implies the | |
136 | .Fl r | |
137 | option. | |
138 | .It Fl v | |
139 | Display information associated with the following keywords: | |
140 | pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz, trss, | |
141 | %cpu, %mem and command. | |
142 | The | |
143 | .Fl v | |
144 | option implies the | |
145 | .Fl m | |
146 | option. | |
147 | .It Fl W | |
148 | Extract swap information from the specified file instead of the | |
149 | default | |
150 | .Dq Pa /dev/swap . | |
151 | .It Fl w | |
152 | Use 132 columns to display information, instead of the default which | |
153 | is your window size. | |
154 | If the | |
155 | .Fl w | |
156 | option is specified more than once, | |
157 | .Nm \&ps | |
158 | will use as many columns as necessary without regard for your window size. | |
159 | .It Fl x | |
160 | Display information about processes without controlling terminals. | |
161 | .El | |
162 | .Pp | |
163 | A complete list of the available keywords are listed below. | |
164 | Some of these keywords are further specifed as follows: | |
165 | .Bl -tag -width indent | |
166 | .It %cpu | |
167 | The cpu utilization of the process; this is a decaying average over up to | |
168 | a minute of previous (real) time. | |
169 | Since the time base over which this is computed varies (since processes may | |
170 | be very young) it is possible for the sum of all | |
171 | .Tn \&%CPU | |
172 | fields to exceed 100%. | |
173 | .It %mem | |
174 | The percentage of real memory used by this process. | |
175 | .It flags | |
176 | The flags (in hexadecimal) associated with the process as in | |
177 | the include file | |
178 | .Aq Pa sys/proc.h : | |
179 | .Bl -column SNOCLDSTOP SNOCLDSTOP | |
180 | .It Dv "SLOAD" Ta No "0x0000001 in core" | |
181 | .It Dv "SSYS" Ta No "0x0000002 swapper or pager process" | |
182 | .It Dv "SLOCK" Ta No "0x0000004 process being swapped out" | |
183 | .It Dv "SSWAP" Ta No "0x0000008 save area flag" | |
184 | .It Dv "STRC" Ta No "0x0000010 process is being traced" | |
185 | .It Dv "SWTED" Ta No "0x0000020 another tracing flag" | |
186 | .It Dv "SSINTR" Ta No "0x0000040 sleep is interruptible" | |
187 | .It Dv "SPAGE" Ta No "0x0000080 process in page wait state" | |
188 | .It Dv "SKEEP" Ta No "0x0000100 another flag to prevent swap out" | |
189 | .It Dv "SOMASK" Ta No "0x0000200 restore old mask after taking signal" | |
190 | .It Dv "SWEXIT" Ta No "0x0000400 working on exiting" | |
191 | .It Dv "SPHYSIO" Ta No "0x0000800 doing physical" | |
192 | .Tn I/O | |
193 | .It Dv "SVFORK" Ta No "0x0001000 process resulted from" | |
194 | .Xr vfork 2 | |
195 | .It Dv "SVFDONE" Ta No "0x0002000 another" | |
196 | .Xr vfork | |
197 | flag | |
198 | .It Dv "SNOVM" Ta No "0x0004000 no vm, parent in a" | |
199 | .Xr vfork | |
200 | .It Dv "SPAGV" Ta No "0x0008000 init data space on demand, from vnode" | |
201 | .It Dv "SSEQL" Ta No "0x0010000 user warned of sequential vm behavior" | |
202 | .It Dv "SUANOM" Ta No "0x0020000 user warned of random vm behavior" | |
203 | .It Dv "STIMO" Ta No "0x0040000 timing out during sleep" | |
204 | .It Dv "SNOCLDSTOP" Ta No "0x0080000 no" | |
205 | .Dv SIGCHLD | |
206 | when children stop | |
207 | .It Dv "SCTTY" Ta No "0x0100000 has a controlling terminal" | |
208 | .It Dv "SOWEUPC" Ta No "0x0200000 owe process an addupc() call at next ast" | |
209 | .\" the routine addupc is not documented in the man pages | |
210 | .It Dv "SSEL" Ta No "0x0400000 selecting; wakeup/waiting danger" | |
211 | .It Dv "SEXEC" Ta No "0x0800000 process called" | |
212 | .Xr exec 2 | |
213 | .It Dv "SHPUX" Ta No "0x1000000 \\*(tNHP-UX\\*(sP process | |
214 | .Pq Dv HPUXCOMPAT | |
215 | .It Dv "SULOCK" Ta No "0x2000000 locked in core after swap error" | |
216 | .It Dv "SPTECHG" Ta No "0x4000000 pte's for process have changed" | |
217 | .El | |
218 | .It lim | |
219 | The soft limit on memory used, specified via a call to | |
220 | .Xr setrlimit 2 . | |
221 | .It lstart | |
222 | The exact time the command started, using the ``%C'' format described in | |
223 | .Xr strftime 3 . | |
224 | .It nice | |
225 | The process scheduling increment (see | |
226 | .Xr setpriority 2 ) . | |
227 | .It rss | |
228 | the real memory (resident set) size of the process (in 1024 byte units). | |
229 | .It start | |
230 | The time the command started. | |
231 | If the command started less than 24 hours ago, the start time is | |
232 | displayed using the ``%l:ps.1p'' format described in | |
233 | .Xr strftime 3 . | |
234 | If the command started less than 7 days ago, the start time is | |
235 | displayed using the ``%a6.15p'' format. | |
236 | Otherwise, the start time is displayed using the ``%e%b%y'' format. | |
237 | .It state | |
238 | The state is given by a sequence of letters, for example, | |
239 | .Dq Tn RWNA . | |
240 | The first letter indicates the run state of the process: | |
241 | .Pp | |
242 | .Bl -tag -width indent -compact | |
243 | .It D | |
244 | Marks a process in disk (or other short term, uninterruptable) wait. | |
245 | .It I | |
246 | Marks a process that is idle (sleeping for longer than about 20 seconds). | |
247 | .It P | |
248 | Marks a process in page wait. | |
249 | .It R | |
250 | Marks a runnable process. | |
251 | .It S | |
252 | Marks a process that is sleeping for less than about 20 seconds. | |
253 | .It T | |
254 | Marks a stopped process. | |
255 | .It Z | |
256 | Marks a dead process (a ``zombie''). | |
257 | .El | |
258 | .Pp | |
259 | Additional characters after these, if any, indicate additional state | |
260 | information: | |
261 | .Pp | |
262 | .Bl -tag -width indent -compact | |
263 | .It + | |
264 | The process is in the foreground process group of its control terminal. | |
265 | .It < | |
266 | The process has raised | |
267 | .Tn CPU | |
268 | scheduling priority. | |
269 | .It > | |
270 | The process has specified a soft limit on memory requirements and is | |
271 | currently exceeding that limit; such a process is (necessarily) not | |
272 | swapped. | |
273 | .It A | |
274 | the process has asked for random page replacement | |
275 | .Pf ( Dv VA_ANOM , | |
276 | from | |
277 | .Xr vadvise 2 , | |
278 | for example, | |
279 | .Xr lisp 1 | |
280 | in a garbage collect). | |
281 | .It E | |
282 | The process is trying to exit. | |
283 | .It L | |
284 | The process has pages locked in core (for example, for raw | |
285 | .Tn I/O ) . | |
286 | .It N | |
287 | The process has reduced | |
288 | .Tn CPU | |
289 | scheduling priority (see | |
290 | .Xr setpriority 2 ) . | |
291 | .It S | |
292 | The process has asked for | |
293 | .Tn FIFO | |
294 | page replacement | |
295 | .Pf ( Dv VA_SEQL , | |
296 | from | |
297 | .Xr vadvise 2 , | |
298 | for example, a large image processing program using virtual memory to | |
299 | sequentially address voluminous data). | |
300 | .It s | |
301 | The process is a session leader. | |
302 | .It V | |
303 | The process is suspended during a | |
304 | .Xr vfork . | |
305 | .It W | |
306 | The process is swapped out. | |
307 | .It X | |
308 | The process is being traced or debugged. | |
309 | .El | |
310 | .It tt | |
311 | An abbreviation for the pathname of the controlling terminal, if any. | |
312 | The abbreviation consists of the two letters following | |
313 | .Dq Pa /dev/tty , | |
314 | or, for the console, ``co''. | |
315 | This is followed by a ``-'' if the process can no longer reach that | |
316 | controlling terminal (i.e., it has been revoked). | |
317 | .It wchan | |
318 | The event (an address in the system) on which a process waits. | |
319 | When printed numerically, the initial part of the address is | |
320 | trimmed off and the result is printed in hex, for example, 0x80324000 prints | |
321 | as 324000. | |
322 | .El | |
323 | .Pp | |
324 | When printing using the command keyword, a process that has exited and | |
325 | has a parent that has not yet waited for the process (in other words, a zombie) | |
326 | is listed as ``<defunct>'', and a process which is blocked while trying | |
327 | to exit is listed as ``<exiting>''. | |
328 | .Nm \&Ps | |
329 | makes an educated guess as to the file name and arguments given when the | |
330 | process was created by examining memory or the swap area. | |
331 | The method is inherently somewhat unreliable and in any event a process | |
332 | is entitled to destroy this information, so the names cannot be depended | |
333 | on too much. | |
334 | The ucomm (accounting) keyword can, however, be depended on. | |
335 | .Sh KEYWORDS | |
336 | The following is a complete list of the available keywords and their | |
337 | meanings. | |
338 | Several of them have aliases (keywords which are synonyms). | |
339 | .Pp | |
340 | .Bl -tag -width sigignore -compact | |
341 | .It %cpu | |
342 | percentage cpu usage (alias pcpu) | |
343 | .It %mem | |
344 | percentage memory usage (alias pmem) | |
345 | .It acflag | |
346 | accounting flag (alias acflg) | |
347 | .It command | |
348 | command and arguments | |
349 | .It cpu | |
350 | short-term cpu usage factor (for scheduling) | |
351 | .It flags | |
352 | the process flags, in hexadecimal (alias f) | |
353 | .It inblk | |
354 | total blocks read (alias inblock) | |
355 | .It jobc | |
356 | job control count | |
357 | .It ktrace | |
358 | tracing flags | |
359 | .It ktracep | |
360 | tracing vnode | |
361 | .It lim | |
362 | memoryuse limit | |
363 | .It logname | |
364 | login name of user who started the process | |
365 | .It lstart | |
366 | time started | |
367 | .It majflt | |
368 | total page faults | |
369 | .It minflt | |
370 | total page reclaims | |
371 | .It msgrcv | |
372 | total messages received (reads from pipes/sockets) | |
373 | .It msgsnd | |
374 | total messages sent (writes on pipes/sockets) | |
375 | .It nice | |
376 | nice value (alias ni) | |
377 | .It nivcsw | |
378 | total involuntary context switches | |
379 | .It nsigs | |
380 | total signals taken (alias nsignals) | |
381 | .It nswap | |
382 | total swaps in/out | |
383 | .It nvcsw | |
384 | total voluntary context switches | |
385 | .It nwchan | |
386 | wait channel (as an address) | |
387 | .It oublk | |
388 | total blocks written (alias oublock) | |
389 | .It p_ru | |
390 | resource usage (valid only for zombie) | |
391 | .It paddr | |
392 | swap address | |
393 | .It pagein | |
394 | pageins (same as majflt) | |
395 | .It pgid | |
396 | process group number | |
397 | .It pid | |
398 | process | |
399 | .Tn ID | |
400 | .It poip | |
401 | pageouts in progress | |
402 | .It ppid | |
403 | parent process | |
404 | .Tn ID | |
405 | .It pri | |
406 | scheduling priority | |
407 | .It re | |
408 | core residency time (in seconds; 127 = infinity) | |
409 | .It rgid | |
410 | real group | |
411 | .Tn ID | |
412 | .It rlink | |
413 | reverse link on run queue, or 0 | |
414 | .It rss | |
415 | resident set size | |
416 | .It rsz | |
417 | resident set size + (text size / text use count) (alias rssize) | |
418 | .It ruid | |
419 | real user | |
420 | .Tn ID | |
421 | .It ruser | |
422 | user name (from ruid) | |
423 | .It sess | |
424 | session pointer | |
425 | .It sig | |
426 | pending signals (alias pending) | |
427 | .It sigcatch | |
428 | caught signals (alias caught) | |
429 | .It sigignore | |
430 | ignored signals (alias ignored) | |
431 | .It sigmask | |
432 | blocked signals (alias blocked) | |
433 | .It sl | |
434 | sleep time (in seconds; 127 = infinity) | |
435 | .It start | |
436 | time started | |
437 | .It state | |
438 | symbolic process state (alias stat) | |
439 | .It svgid | |
440 | saved gid from a setgid executable | |
441 | .It svuid | |
442 | saved uid from a setuid executable | |
443 | .It tdev | |
444 | control terminal device number | |
445 | .It time | |
446 | accumulated cpu time, user + system (alias cputime) | |
447 | .It tpgid | |
448 | control terminal process group | |
449 | .Tn ID | |
450 | .It trss | |
451 | text resident set size (in Kbytes) | |
452 | .It tsess | |
453 | control terminal session pointer | |
454 | .It tsiz | |
455 | text size (in Kbytes) | |
456 | .It tt | |
457 | control terminal name (two letter abbreviation) | |
458 | .It tty | |
459 | full name of control terminal | |
460 | .It uprocp | |
461 | process pointer | |
462 | .It ucomm | |
463 | name to be used for accounting | |
464 | .It uid | |
465 | effective user | |
466 | .Tn ID | |
467 | .It upr | |
468 | scheduling priority on return from system call (alias usrpri) | |
469 | .It user | |
470 | user name (from uid) | |
471 | .It vsz | |
472 | virtual size in Kbytes (alias vsize) | |
473 | .It wchan | |
474 | wait channel (as a symbolic name) | |
475 | .It xstat | |
476 | exit or stop status (valid only for stopped or zombie process) | |
477 | .El | |
478 | .Sh FILES | |
479 | .Bl -tag -width /var/run/kvm_vmunix.db -compact | |
480 | .It Pa /dev | |
481 | special files and device names | |
482 | .It Pa /dev/drum | |
483 | default swap device | |
484 | .It Pa /dev/kmem | |
485 | default kernel memory | |
486 | .It Pa /var/run/dev.db | |
487 | /dev name database | |
488 | .It Pa /var/run/kvm_vmunix.db | |
489 | system namelist database | |
490 | .It Pa /vmunix | |
491 | default system namelist | |
492 | .El | |
493 | .Sh SEE ALSO | |
494 | .Xr kill 1 , | |
495 | .Xr w 1 , | |
496 | .Xr kvm 3 , | |
497 | .Xr strftime 3 , | |
498 | .Xr pstat 8 | |
499 | .Sh BUGS | |
500 | Since | |
501 | .Nm \&ps | |
502 | cannot run faster than the system and is run as any other scheduled | |
503 | process, the information it displays can never be exact. |