Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / bin / ps / ps.1
1 .\" Copyright (c) 1980, 1990, 1991, 1993, 1994
2 .\"     The Regents of the University of California.  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        8.3 (Berkeley) 4/18/94
33 .\" $FreeBSD: src/bin/ps/ps.1,v 1.24.2.7 2002/06/20 22:43:33 charnier Exp $
34 .\" $DragonFly: src/bin/ps/ps.1,v 1.2 2003/06/17 04:22:50 dillon Exp $
35 .\"
36 .Dd April 18, 1994
37 .Dt PS 1
38 .Os
39 .Sh NAME
40 .Nm ps
41 .Nd process status
42 .Sh SYNOPSIS
43 .Nm
44 .Op Fl aCcefhjlmrSTuvwx
45 .Op Fl M Ar core
46 .Op Fl N Ar system
47 .Op Fl O Ar fmt
48 .Op Fl o Ar fmt
49 .Op Fl p Ar pid
50 .Op Fl t Ar tty
51 .Op Fl U Ar username
52 .Nm
53 .Op Fl L
54 .Sh DESCRIPTION
55 The
56 .Nm
57 utility
58 displays a header line followed by lines containing information about your
59 processes that have controlling terminals.
60 This information is sorted by controlling terminal, then by process
61 .Tn ID .
62 .Pp
63 The information displayed is selected based on a set of keywords (see the
64 .Fl L
65 .Fl O
66 and
67 .Fl o
68 options).
69 The default output format includes, for each process, the process'
70 .Tn ID ,
71 controlling terminal, cpu time (including both user and system time),
72 state, and associated command.
73 .Pp
74 The process file system (see
75 .Xr procfs 5 )
76 should be mounted when
77 .Nm
78 is executed, otherwise not all information will be available.
79 .Pp
80 The options are as follows:
81 .Bl -tag -width indent
82 .It Fl a
83 Display information about other users' processes as well as your own.
84 This can be disabled by setting the
85 .Va kern.ps_showallprocs
86 sysctl to zero.
87 .It Fl c
88 Change the ``command'' column output to just contain the executable name,
89 rather than the full command line.
90 .It Fl C
91 Change the way the cpu percentage is calculated by using a ``raw''
92 cpu calculation that ignores ``resident'' time (this normally has
93 no effect).
94 .It Fl e
95 Display the environment as well.
96 .It Fl f
97 Show commandline and environment information about swapped out processes.
98 This option is honored only if the uid of the user is 0.
99 .It Fl h
100 Repeat the information header as often as necessary to guarantee one
101 header per page of information.
102 .It Fl j
103 Print information associated with the following keywords:
104 user, pid, ppid, pgid, sess, jobc, state, tt, time and command.
105 .It Fl L
106 List the set of available keywords.
107 .It Fl l
108 Display information associated with the following keywords:
109 uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time
110 and command.
111 .It Fl M
112 Extract values associated with the name list from the specified core
113 instead of the default
114 .Pa /dev/kmem .
115 .It Fl m
116 Sort by memory usage, instead of by process
117 .Tn ID .
118 .It Fl N
119 Extract the name list from the specified system instead of the default
120 .Pa /kernel .
121 .It Fl O
122 Add the information associated with the space or comma separated list
123 of keywords specified, after the process
124 .Tn ID ,
125 in the default information
126 display.
127 Keywords may be appended with an equals (``='') sign and a string.
128 This causes the printed header to use the specified string instead of
129 the standard header.
130 .It Fl o
131 Display information associated with the space or comma separated list
132 of keywords specified.
133 Keywords may be appended with an equals (``='') sign and a string.
134 This causes the printed header to use the specified string instead of
135 the standard header.
136 .It Fl p
137 Display information associated with the specified process
138 .Tn ID .
139 .It Fl r
140 Sort by current cpu usage, instead of by process
141 .Tn ID .
142 .It Fl S
143 Change the way the process time is calculated by summing all exited
144 children to their parent process.
145 .It Fl T
146 Display information about processes attached to the device associated
147 with the standard input.
148 .It Fl t
149 Display information about processes attached to the specified terminal
150 device.
151 .It Fl U
152 Display the processes belonging to the specified
153 .Ar username .
154 .It Fl u
155 Display information associated with the following keywords:
156 user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command.
157 The
158 .Fl u
159 option implies the
160 .Fl r
161 option.
162 .It Fl v
163 Display information associated with the following keywords:
164 pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz,
165 %cpu, %mem and command.
166 The
167 .Fl v
168 option implies the
169 .Fl m
170 option.
171 .It Fl w
172 Use 132 columns to display information, instead of the default which
173 is your window size.
174 If the
175 .Fl w
176 option is specified more than once,
177 .Nm
178 will use as many columns as necessary without regard for your window size.
179 .It Fl x
180 Display information about processes without controlling terminals.
181 .El
182 .Pp
183 A complete list of the available keywords are listed below.
184 Some of these keywords are further specified as follows:
185 .Bl -tag -width indent
186 .It %cpu
187 The cpu utilization of the process; this is a decaying average over up to
188 a minute of previous (real) time.
189 Since the time base over which this is computed varies (since processes may
190 be very young) it is possible for the sum of all
191 .Tn \&%CPU
192 fields to exceed 100%.
193 .It %mem
194 The percentage of real memory used by this process.
195 .It flags
196 The flags associated with the process as in
197 the include file
198 .Aq Pa sys/proc.h :
199 .Bl -column P_NOCLDSTOP P_NOCLDSTOP
200 .It Dv "P_ADVLOCK" Ta No "0x00001       Process may hold a POSIX advisory lock"
201 .It Dv "P_CONTROLT" Ta No "0x00002      Has a controlling terminal"
202 .It Dv "P_INMEM" Ta No "0x00004         Loaded into memory"
203 .It Dv "P_NOCLDSTOP" Ta No "0x00008     No SIGCHLD when children stop"
204 .It Dv "P_PPWAIT" Ta No "0x00010        Parent is waiting for child to exec/exit"
205 .It Dv "P_PROFIL" Ta No "0x00020        Has started profiling"
206 .It Dv "P_SELECT" Ta No "0x00040        Selecting; wakeup/waiting danger"
207 .It Dv "P_SINTR" Ta No "0x00080         Sleep is interruptible"
208 .It Dv "P_SUGID" Ta No "0x00100         Had set id privileges since last exec"
209 .It Dv "P_SYSTEM" Ta No "0x00200        System proc: no sigs, stats or swapping"
210 .It Dv "P_TIMEOUT" Ta No "0x00400       Timing out during sleep"
211 .It Dv "P_TRACED" Ta No "0x00800        Debugged process being traced"
212 .It Dv "P_WAITED" Ta No "0x01000        Debugging process has waited for child"
213 .It Dv "P_WEXIT" Ta No "0x02000         Working on exiting"
214 .It Dv "P_EXEC" Ta No "0x04000          Process called exec"
215 .It Dv "P_OWEUPC" Ta No "0x20000        Owe process an addupc() call at next ast"
216 .It Dv "P_SWAPPING" Ta No "0x40000      Process is being swapped"
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, uninterruptible) wait.
245 .It I
246 Marks a process that is idle (sleeping for longer than about 20 seconds).
247 .It J
248 Marks a process which is in
249 .Xr jail 2 .
250 The hostname of the prison can be found in
251 .Ql Li /proc/<pid>/status .
252 .It R
253 Marks a runnable process.
254 .It S
255 Marks a process that is sleeping for less than about 20 seconds.
256 .It T
257 Marks a stopped process.
258 .It Z
259 Marks a dead process (a ``zombie'').
260 .El
261 .Pp
262 Additional characters after these, if any, indicate additional state
263 information:
264 .Pp
265 .Bl -tag -width indent -compact
266 .It +
267 The process is in the foreground process group of its control terminal.
268 .It <
269 The process has raised
270 .Tn CPU
271 scheduling priority.
272 .It >
273 The process has specified a soft limit on memory requirements and is
274 currently exceeding that limit; such a process is (necessarily) not
275 swapped.
276 .It A
277 the process has asked for random page replacement
278 .Pf ( Dv MADV_RANDOM ,
279 from
280 .Xr madvise 2 ,
281 for example,
282 .Xr lisp 1
283 in a garbage collect).
284 .It E
285 The process is trying to exit.
286 .It L
287 The process has pages locked in core (for example, for raw
288 .Tn I/O ) .
289 .It N
290 The process has reduced
291 .Tn CPU
292 scheduling priority (see
293 .Xr setpriority 2 ) .
294 .It S
295 The process has asked for
296 .Tn FIFO
297 page replacement
298 .Pf ( Dv MADV_SEQUENTIAL ,
299 from
300 .Xr madvise 2 ,
301 for example, a large image processing program using virtual memory to
302 sequentially address voluminous data).
303 .It s
304 The process is a session leader.
305 .It V
306 The process is suspended during a
307 .Xr vfork .
308 .It W
309 The process is swapped out.
310 .It X
311 The process is being traced or debugged.
312 .El
313 .It tt
314 An abbreviation for the pathname of the controlling terminal, if any.
315 The abbreviation consists of the three letters following
316 .Pa /dev/tty ,
317 or, for the console, ``con''.
318 This is followed by a ``-'' if the process can no longer reach that
319 controlling terminal (i.e., it has been revoked).
320 .It wchan
321 The event (an address in the system) on which a process waits.
322 When printed numerically, the initial part of the address is
323 trimmed off and the result is printed in hex, for example, 0x80324000 prints
324 as 324000.
325 .El
326 .Pp
327 When printing using the command keyword, a process that has exited and
328 has a parent that has not yet waited for the process (in other words, a zombie)
329 is listed as ``<defunct>'', and a process which is blocked while trying
330 to exit is listed as ``<exiting>''.
331 The
332 .Nm
333 utility
334 makes an educated guess as to the file name and arguments given when the
335 process was created by examining memory or the swap area.
336 The method is inherently somewhat unreliable and in any event a process
337 is entitled to destroy this information, so the names cannot be depended
338 on too much.
339 The ucomm (accounting) keyword can, however, be depended on.
340 .Sh KEYWORDS
341 The following is a complete list of the available keywords and their
342 meanings.
343 Several of them have aliases (keywords which are synonyms).
344 .Pp
345 .Bl -tag -width sigignore -compact
346 .It %cpu
347 percentage cpu usage (alias pcpu)
348 .It %mem
349 percentage memory usage (alias pmem)
350 .It acflag
351 accounting flag (alias acflg)
352 .It command
353 command and arguments
354 .It cpu
355 short-term cpu usage factor (for scheduling)
356 .It flags
357 the process flags, in hexadecimal (alias f)
358 .It inblk
359 total blocks read (alias inblock)
360 .It jobc
361 job control count
362 .It ktrace
363 tracing flags
364 .It ktracep
365 tracing vnode
366 .It lim
367 memoryuse limit
368 .It logname
369 login name of user who started the process
370 .It lstart
371 time started
372 .It majflt
373 total page faults
374 .It minflt
375 total page reclaims
376 .It msgrcv
377 total messages received (reads from pipes/sockets)
378 .It msgsnd
379 total messages sent (writes on pipes/sockets)
380 .It nice
381 nice value (alias ni)
382 .It nivcsw
383 total involuntary context switches
384 .It nsigs
385 total signals taken (alias nsignals)
386 .It nswap
387 total swaps in/out
388 .It nvcsw
389 total voluntary context switches
390 .It nwchan
391 wait channel (as an address)
392 .It oublk
393 total blocks written (alias oublock)
394 .It p_ru
395 resource usage (valid only for zombie)
396 .It paddr
397 swap address
398 .It pagein
399 pageins (same as majflt)
400 .It pgid
401 process group number
402 .It pid
403 process
404 .Tn ID
405 .It poip
406 pageouts in progress
407 .It ppid
408 parent process
409 .Tn ID
410 .It pri
411 scheduling priority
412 .It re
413 core residency time (in seconds; 127 = infinity)
414 .It rgid
415 real group
416 .Tn ID
417 .It rlink
418 reverse link on run queue, or 0
419 .It rss
420 resident set size
421 .It rsz
422 resident set size + (text size / text use count) (alias rssize)
423 .It rtprio
424 realtime priority (101 = not a realtime process)
425 .It ruid
426 real user
427 .Tn ID
428 .It ruser
429 user name (from ruid)
430 .It sess
431 session pointer
432 .It sig
433 pending signals (alias pending)
434 .It sigcatch
435 caught signals (alias caught)
436 .It sigignore
437 ignored signals (alias ignored)
438 .It sigmask
439 blocked signals (alias blocked)
440 .It sl
441 sleep time (in seconds; 127 = infinity)
442 .It start
443 time started
444 .It state
445 symbolic process state (alias stat)
446 .It svgid
447 saved gid from a setgid executable
448 .It svuid
449 saved uid from a setuid executable
450 .It tdev
451 control terminal device number
452 .It time
453 accumulated cpu time, user + system (alias cputime)
454 .It tpgid
455 control terminal process group
456 .Tn ID
457 .\".It trss
458 .\"text resident set size (in Kbytes)
459 .It tsess
460 control terminal session pointer
461 .It tsiz
462 text size (in Kbytes)
463 .It tt
464 control terminal name (two letter abbreviation)
465 .It tty
466 full name of control terminal
467 .It uprocp
468 process pointer
469 .It ucomm
470 name to be used for accounting
471 .It uid
472 effective user
473 .Tn ID
474 .It upr
475 scheduling priority on return from system call (alias usrpri)
476 .It user
477 user name (from uid)
478 .It vsz
479 virtual size in Kbytes (alias vsize)
480 .It wchan
481 wait channel (as a symbolic name)
482 .It xstat
483 exit or stop status (valid only for stopped or zombie process)
484 .El
485 .Sh FILES
486 .Bl -tag -width /var/db/kvm_kernel.db -compact
487 .It Pa /dev/kmem
488 default kernel memory
489 .It Pa /var/run/dev.db
490 /dev name database
491 .It Pa /var/db/kvm_kernel.db
492 system namelist database
493 .It Pa /kernel
494 default system namelist
495 .It Pa /proc
496 the mount point of
497 .Xr procfs 5
498 .El
499 .Sh SEE ALSO
500 .Xr kill 1 ,
501 .Xr w 1 ,
502 .Xr kvm 3 ,
503 .Xr strftime 3 ,
504 .Xr procfs 5 ,
505 .Xr pstat 8 ,
506 .Xr sysctl 8
507 .Sh BUGS
508 Since
509 .Nm
510 cannot run faster than the system and is run as any other scheduled
511 process, the information it displays can never be exact.