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