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