xref: /386bsd/usr/src/bin/ps/ps.1 (revision a2142627)
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
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
75Change the way the cpu percentage is calculated by using a ``raw''
76cpu calculation that ignores ``resident'' time (this normally has
77no effect).
78.It Fl h
79Repeat the information header as often as necessary to guarantee one
80header per page of information.
81.It Fl j
82Print information associated with the following keywords:
83user, pid, ppid, pgid, sess, jobc, state, tt, time and command.
84.It Fl L
85List the set of available keywords.
86.It Fl l
87Display information associated with the following keywords:
88uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time
89and command.
90.It Fl M
91Extract values associated with the name list from the specified core
92instead of the default
93.Dq Pa /dev/kmem .
94.It Fl m
95Sort by memory usage, instead of by process
96.Tn ID .
97.It Fl N
98Extract the name list from the specified system instead of the default
99.Dq Pa /vmunix .
100.It Fl O
101Add the information associated with the space or comma separated list
102of keywords specifed, after the process
103.Tn ID ,
104in the default information
105display.
106Keywords may be appended with an equals (``='') sign and a string.
107This causes the printed header to use the specified string instead of
108the standard header.
109.It Fl o
110Display information associated with the space or comma separated list
111of keywords specifed.
112Keywords may be appended with an equals (``='') sign and a string.
113This causes the printed header to use the specified string instead of
114the standard header.
115.It Fl p
116Display information associated with the specified process
117.Tn ID .
118.It Fl r
119Sort by current cpu usage, instead of by process
120.Tn ID .
121.It Fl S
122Change the way the process time is calculated by summing all exited
123children to their parent process.
124.It Fl T
125Display information about processes attached to the device associated
126with the standard input.
127.It Fl t
128Display information about processes attached to the specified terminal
129device.
130.It Fl u
131Display information associated with the following keywords:
132user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command.
133The
134.Fl u
135option implies the
136.Fl r
137option.
138.It Fl v
139Display information associated with the following keywords:
140pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz, trss,
141%cpu, %mem and command.
142The
143.Fl v
144option implies the
145.Fl m
146option.
147.It Fl W
148Extract swap information from the specified file instead of the
149default
150.Dq Pa /dev/swap .
151.It Fl w
152Use 132 columns to display information, instead of the default which
153is your window size.
154If the
155.Fl w
156option is specified more than once,
157.Nm \&ps
158will use as many columns as necessary without regard for your window size.
159.It Fl x
160Display information about processes without controlling terminals.
161.El
162.Pp
163A complete list of the available keywords are listed below.
164Some of these keywords are further specifed as follows:
165.Bl -tag -width indent
166.It %cpu
167The cpu utilization of the process; this is a decaying average over up to
168a minute of previous (real) time.
169Since the time base over which this is computed varies (since processes may
170be very young) it is possible for the sum of all
171.Tn \&%CPU
172fields to exceed 100%.
173.It %mem
174The percentage of real memory used by this process.
175.It flags
176The flags (in hexadecimal) associated with the process as in
177the 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
197flag
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
206when 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
219The soft limit on memory used, specified via a call to
220.Xr setrlimit 2 .
221.It lstart
222The exact time the command started, using the ``%C'' format described in
223.Xr strftime 3 .
224.It nice
225The process scheduling increment (see
226.Xr setpriority 2 ) .
227.It rss
228the real memory (resident set) size of the process (in 1024 byte units).
229.It start
230The time the command started.
231If the command started less than 24 hours ago, the start time is
232displayed using the ``%l:ps.1p'' format described in
233.Xr strftime 3 .
234If the command started less than 7 days ago, the start time is
235displayed using the ``%a6.15p'' format.
236Otherwise, the start time is displayed using the ``%e%b%y'' format.
237.It state
238The state is given by a sequence of letters, for example,
239.Dq Tn RWNA .
240The first letter indicates the run state of the process:
241.Pp
242.Bl -tag -width indent -compact
243.It D
244Marks a process in disk (or other short term, uninterruptable) wait.
245.It I
246Marks a process that is idle (sleeping for longer than about 20 seconds).
247.It P
248Marks a process in page wait.
249.It R
250Marks a runnable process.
251.It S
252Marks a process that is sleeping for less than about 20 seconds.
253.It T
254Marks a stopped process.
255.It Z
256Marks a dead process (a ``zombie'').
257.El
258.Pp
259Additional characters after these, if any, indicate additional state
260information:
261.Pp
262.Bl -tag -width indent -compact
263.It +
264The process is in the foreground process group of its control terminal.
265.It <
266The process has raised
267.Tn CPU
268scheduling priority.
269.It >
270The process has specified a soft limit on memory requirements and is
271currently exceeding that limit; such a process is (necessarily) not
272swapped.
273.It A
274the process has asked for random page replacement
275.Pf ( Dv VA_ANOM ,
276from
277.Xr vadvise 2 ,
278for example,
279.Xr lisp 1
280in a garbage collect).
281.It E
282The process is trying to exit.
283.It L
284The process has pages locked in core (for example, for raw
285.Tn I/O ) .
286.It N
287The process has reduced
288.Tn CPU
289scheduling priority (see
290.Xr setpriority 2 ) .
291.It S
292The process has asked for
293.Tn FIFO
294page replacement
295.Pf ( Dv VA_SEQL ,
296from
297.Xr vadvise 2 ,
298for example, a large image processing program using virtual memory to
299sequentially address voluminous data).
300.It s
301The process is a session leader.
302.It V
303The process is suspended during a
304.Xr vfork .
305.It W
306The process is swapped out.
307.It X
308The process is being traced or debugged.
309.El
310.It tt
311An abbreviation for the pathname of the controlling terminal, if any.
312The abbreviation consists of the two letters following
313.Dq Pa /dev/tty ,
314or, for the console, ``co''.
315This is followed by a ``-'' if the process can no longer reach that
316controlling terminal (i.e., it has been revoked).
317.It wchan
318The event (an address in the system) on which a process waits.
319When printed numerically, the initial part of the address is
320trimmed off and the result is printed in hex, for example, 0x80324000 prints
321as 324000.
322.El
323.Pp
324When printing using the command keyword, a process that has exited and
325has a parent that has not yet waited for the process (in other words, a zombie)
326is listed as ``<defunct>'', and a process which is blocked while trying
327to exit is listed as ``<exiting>''.
328.Nm \&Ps
329makes an educated guess as to the file name and arguments given when the
330process was created by examining memory or the swap area.
331The method is inherently somewhat unreliable and in any event a process
332is entitled to destroy this information, so the names cannot be depended
333on too much.
334The ucomm (accounting) keyword can, however, be depended on.
335.Sh KEYWORDS
336The following is a complete list of the available keywords and their
337meanings.
338Several of them have aliases (keywords which are synonyms).
339.Pp
340.Bl -tag -width sigignore -compact
341.It %cpu
342percentage cpu usage (alias pcpu)
343.It %mem
344percentage memory usage (alias pmem)
345.It acflag
346accounting flag (alias acflg)
347.It command
348command and arguments
349.It cpu
350short-term cpu usage factor (for scheduling)
351.It flags
352the process flags, in hexadecimal (alias f)
353.It inblk
354total blocks read (alias inblock)
355.It jobc
356job control count
357.It ktrace
358tracing flags
359.It ktracep
360tracing vnode
361.It lim
362memoryuse limit
363.It logname
364login name of user who started the process
365.It lstart
366time started
367.It majflt
368total page faults
369.It minflt
370total page reclaims
371.It msgrcv
372total messages received (reads from pipes/sockets)
373.It msgsnd
374total messages sent (writes on pipes/sockets)
375.It nice
376nice value (alias ni)
377.It nivcsw
378total involuntary context switches
379.It nsigs
380total signals taken (alias nsignals)
381.It nswap
382total swaps in/out
383.It nvcsw
384total voluntary context switches
385.It nwchan
386wait channel (as an address)
387.It oublk
388total blocks written (alias oublock)
389.It p_ru
390resource usage (valid only for zombie)
391.It paddr
392swap address
393.It pagein
394pageins (same as majflt)
395.It pgid
396process group number
397.It pid
398process
399.Tn ID
400.It poip
401pageouts in progress
402.It ppid
403parent process
404.Tn ID
405.It pri
406scheduling priority
407.It re
408core residency time (in seconds; 127 = infinity)
409.It rgid
410real group
411.Tn ID
412.It rlink
413reverse link on run queue, or 0
414.It rss
415resident set size
416.It rsz
417resident set size + (text size / text use count) (alias rssize)
418.It ruid
419real user
420.Tn ID
421.It ruser
422user name (from ruid)
423.It sess
424session pointer
425.It sig
426pending signals (alias pending)
427.It sigcatch
428caught signals (alias caught)
429.It sigignore
430ignored signals (alias ignored)
431.It sigmask
432blocked signals (alias blocked)
433.It sl
434sleep time (in seconds; 127 = infinity)
435.It start
436time started
437.It state
438symbolic process state (alias stat)
439.It svgid
440saved gid from a setgid executable
441.It svuid
442saved uid from a setuid executable
443.It tdev
444control terminal device number
445.It time
446accumulated cpu time, user + system (alias cputime)
447.It tpgid
448control terminal process group
449.Tn ID
450.It trss
451text resident set size (in Kbytes)
452.It tsess
453control terminal session pointer
454.It tsiz
455text size (in Kbytes)
456.It tt
457control terminal name (two letter abbreviation)
458.It tty
459full name of control terminal
460.It uprocp
461process pointer
462.It ucomm
463name to be used for accounting
464.It uid
465effective user
466.Tn ID
467.It upr
468scheduling priority on return from system call (alias usrpri)
469.It user
470user name (from uid)
471.It vsz
472virtual size in Kbytes (alias vsize)
473.It wchan
474wait channel (as a symbolic name)
475.It xstat
476exit 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
481special files and device names
482.It Pa /dev/drum
483default swap device
484.It Pa /dev/kmem
485default kernel memory
486.It Pa /var/run/dev.db
487/dev name database
488.It Pa /var/run/kvm_vmunix.db
489system namelist database
490.It Pa /vmunix
491default 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
500Since
501.Nm \&ps
502cannot run faster than the system and is run as any other scheduled
503process, the information it displays can never be exact.
504