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