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