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