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