xref: /freebsd/bin/ps/ps.1 (revision 17ee9d00bc1ae1e598c38f25826f861e4bc6c3ce)
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.\"	$Id$
34.\"
35.Dd April 18, 1994
36.Dt PS 1
37.Os BSD 4
38.Sh NAME
39.Nm \&ps
40.Nd process status
41.Sh SYNOPSIS
42.Nm \&ps
43.Op Fl aCehjlmrSTuvwx
44.Op Fl M Ar core
45.Op Fl N Ar system
46.Op Fl O Ar fmt
47.Op Fl o Ar fmt
48.Op Fl p Ar pid
49.Op Fl t Ar tty
50.Op Fl W Ar swap
51.Nm ps
52.Op Fl L
53.Sh DESCRIPTION
54.Nm \&Ps
55displays a header line followed by lines containing information about your
56processes that have controlling terminals.
57This information is sorted by process
58.Tn ID .
59.Pp
60The information displayed is selected based on a set of keywords (see the
61.Fl L
62.Fl O
63and
64.Fl o
65options).
66The default output format includes, for each process, the process'
67.Tn ID ,
68controlling terminal, cpu time (including both user and system time),
69state, and associated command.
70.Pp
71The options are as follows:
72.Bl -tag -width indent
73.It Fl a
74Display information about other users' processes as well as your own.
75.It Fl C
76Change the way the cpu percentage is calculated by using a ``raw''
77cpu calculation that ignores ``resident'' time (this normally has
78no effect).
79.It Fl e
80Display the environment as well.
81.It Fl h
82Repeat the information header as often as necessary to guarantee one
83header per page of information.
84.It Fl j
85Print information associated with the following keywords:
86user, pid, ppid, pgid, sess, jobc, state, tt, time and command.
87.It Fl L
88List the set of available keywords.
89.It Fl l
90Display information associated with the following keywords:
91uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time
92and command.
93.It Fl M
94Extract values associated with the name list from the specified core
95instead of the default
96.Dq Pa /dev/kmem .
97.It Fl m
98Sort by memory usage, instead of by process
99.Tn ID .
100.It Fl N
101Extract the name list from the specified system instead of the default
102.Dq Pa /kernel .
103.It Fl O
104Add the information associated with the space or comma separated list
105of keywords specified, after the process
106.Tn ID ,
107in the default information
108display.
109Keywords may be appended with an equals (``='') sign and a string.
110This causes the printed header to use the specified string instead of
111the standard header.
112.It Fl o
113Display information associated with the space or comma separated list
114of keywords specified.
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 p
119Display information associated with the specified process
120.Tn ID .
121.It Fl r
122Sort by current cpu usage, instead of by process
123.Tn ID .
124.It Fl S
125Change the way the process time is calculated by summing all exited
126children to their parent process.
127.It Fl T
128Display information about processes attached to the device associated
129with the standard input.
130.It Fl t
131Display information about processes attached to the specified terminal
132device.
133.It Fl u
134Display information associated with the following keywords:
135user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command.
136The
137.Fl u
138option implies the
139.Fl r
140option.
141.It Fl v
142Display information associated with the following keywords:
143pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz,
144%cpu, %mem and command.
145The
146.Fl v
147option implies the
148.Fl m
149option.
150.It Fl W
151Extract swap information from the specified file instead of the
152default
153.Dq Pa /dev/swap .
154.It Fl w
155Use 132 columns to display information, instead of the default which
156is your window size.
157If the
158.Fl w
159option is specified more than once,
160.Nm \&ps
161will use as many columns as necessary without regard for your window size.
162.It Fl x
163Display information about processes without controlling terminals.
164.El
165.Pp
166A complete list of the available keywords are listed below.
167Some of these keywords are further specified as follows:
168.Bl -tag -width indent
169.It %cpu
170The cpu utilization of the process; this is a decaying average over up to
171a minute of previous (real) time.
172Since the time base over which this is computed varies (since processes may
173be very young) it is possible for the sum of all
174.Tn \&%CPU
175fields to exceed 100%.
176.It %mem
177The percentage of real memory used by this process.
178.It flags
179The flags (in hexadecimal) associated with the process as in
180the include file
181.Aq Pa sys/proc.h :
182.Bl -column SNOCLDSTOP SNOCLDSTOP
183.It Dv "SLOAD" Ta No "0x0000001	in core"
184.It Dv "SSYS" Ta No "0x0000002	swapper or pager process"
185.It Dv "SLOCK" Ta No "0x0000004	process being swapped out"
186.It Dv "SSWAP" Ta No "0x0000008	save area flag"
187.It Dv "STRC" Ta No "0x0000010	process is being traced"
188.It Dv "SWTED" Ta No "0x0000020	another tracing flag"
189.It Dv "SSINTR" Ta No "0x0000040	sleep is interruptible"
190.It Dv "SKEEP" Ta No "0x0000100	another flag to prevent swap out"
191.It Dv "SOMASK" Ta No "0x0000200	restore old mask after taking signal"
192.It Dv "SWEXIT" Ta No "0x0000400	working on exiting"
193.It Dv "SPHYSIO" Ta No "0x0000800	doing physical"
194.Tn I/O
195.It Dv "SVFORK" Ta No "0x0001000	process resulted from"
196.Xr vfork 2
197.It Dv "SVFDONE" Ta No "0x0002000	another"
198.Xr vfork
199flag
200.It Dv "SNOVM" Ta No "0x0004000	no vm, parent in a"
201.Xr vfork
202.It Dv "SPAGV" Ta No "0x0008000	init data space on demand, from vnode"
203.It Dv "SSEQL" Ta No "0x0010000	user warned of sequential vm behavior"
204.It Dv "SUANOM" Ta No "0x0020000	user warned of random vm behavior"
205.It Dv "STIMO" Ta No "0x0040000	timing out during sleep"
206.It Dv "SNOCLDSTOP" Ta No "0x0080000	no"
207.Dv SIGCHLD
208when children stop
209.It Dv "SCTTY" Ta No "0x0100000	has a controlling terminal"
210.It Dv "SOWEUPC" Ta No "0x0200000	owe process an addupc() call at next ast"
211.\" the routine addupc is not documented in the man pages
212.It Dv "SSEL" Ta No "0x0400000	selecting; wakeup/waiting danger"
213.It Dv "SEXEC" Ta No "0x0800000	process called"
214.Xr exec 2
215.It Dv "SHPUX" Ta No "0x1000000	\\*(tNHP-UX\\*(sP process
216.Pq Dv HPUXCOMPAT
217.It Dv "SULOCK" Ta No "0x2000000	locked in core after swap error"
218.It Dv "SPTECHG" Ta No "0x4000000	pte's for process have changed"
219.El
220.It lim
221The soft limit on memory used, specified via a call to
222.Xr setrlimit 2 .
223.It lstart
224The exact time the command started, using the ``%C'' format described in
225.Xr strftime 3 .
226.It nice
227The process scheduling increment (see
228.Xr setpriority 2 ) .
229.It rss
230the real memory (resident set) size of the process (in 1024 byte units).
231.It start
232The time the command started.
233If the command started less than 24 hours ago, the start time is
234displayed using the ``%l:ps.1p'' format described in
235.Xr strftime 3 .
236If the command started less than 7 days ago, the start time is
237displayed using the ``%a6.15p'' format.
238Otherwise, the start time is displayed using the ``%e%b%y'' format.
239.It state
240The state is given by a sequence of letters, for example,
241.Dq Tn RWNA .
242The first letter indicates the run state of the process:
243.Pp
244.Bl -tag -width indent -compact
245.It D
246Marks a process in disk (or other short term, uninterruptible) wait.
247.It I
248Marks a process that is idle (sleeping for longer than about 20 seconds).
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 rtprio
419realtime priority (101 = not a realtime process)
420.It ruid
421real user
422.Tn ID
423.It ruser
424user name (from ruid)
425.It sess
426session pointer
427.It sig
428pending signals (alias pending)
429.It sigcatch
430caught signals (alias caught)
431.It sigignore
432ignored signals (alias ignored)
433.It sigmask
434blocked signals (alias blocked)
435.It sl
436sleep time (in seconds; 127 = infinity)
437.It start
438time started
439.It state
440symbolic process state (alias stat)
441.It svgid
442saved gid from a setgid executable
443.It svuid
444saved uid from a setuid executable
445.It tdev
446control terminal device number
447.It time
448accumulated cpu time, user + system (alias cputime)
449.It tpgid
450control terminal process group
451.Tn ID
452.\".It trss
453.\"text resident set size (in Kbytes)
454.It tsess
455control terminal session pointer
456.It tsiz
457text size (in Kbytes)
458.It tt
459control terminal name (two letter abbreviation)
460.It tty
461full name of control terminal
462.It uprocp
463process pointer
464.It ucomm
465name to be used for accounting
466.It uid
467effective user
468.Tn ID
469.It upr
470scheduling priority on return from system call (alias usrpri)
471.It user
472user name (from uid)
473.It vsz
474virtual size in Kbytes (alias vsize)
475.It wchan
476wait channel (as a symbolic name)
477.It xstat
478exit or stop status (valid only for stopped or zombie process)
479.El
480.Sh FILES
481.Bl -tag -width /var/run/kvm_kernel.db -compact
482.It Pa /dev
483special files and device names
484.It Pa /dev/drum
485default swap device
486.It Pa /dev/kmem
487default kernel memory
488.It Pa /var/run/dev.db
489/dev name database
490.It Pa /var/run/kvm_kernel.db
491system namelist database
492.It Pa /kernel
493default system namelist
494.El
495.Sh SEE ALSO
496.Xr kill 1 ,
497.Xr w 1 ,
498.Xr kvm 3 ,
499.Xr strftime 3 ,
500.Xr pstat 8
501.Sh BUGS
502Since
503.Nm \&ps
504cannot run faster than the system and is run as any other scheduled
505process, the information it displays can never be exact.
506