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