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.9 1996/04/19 22:23:27 smpatel 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/drum . 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 associated with the process as in 190the include file 191.Aq Pa sys/proc.h : 192.Bl -column P_NOCLDSTOP P_NOCLDSTOP 193.It Dv "P_ADVLOCK" Ta No "0x00001 Process may hold a POSIX advisory lock" 194.It Dv "P_CONTROLT" Ta No "0x00002 Has a controlling terminal" 195.It Dv "P_INMEM" Ta No "0x00004 Loaded into memory" 196.It Dv "P_NOCLDSTOP" Ta No "0x00008 No SIGCHLD when children stop" 197.It Dv "P_PPWAIT" Ta No "0x00010 Parent is waiting for child to exec/exit" 198.It Dv "P_PROFIL" Ta No "0x00020 Has started profiling" 199.It Dv "P_SELECT" Ta No "0x00040 Selecting; wakeup/waiting danger" 200.It Dv "P_SINTR" Ta No "0x00080 Sleep is interruptible" 201.It Dv "P_SUGID" Ta No "0x00100 Had set id privileges since last exec" 202.It Dv "P_SYSTEM" Ta No "0x00200 System proc: no sigs, stats or swapping" 203.It Dv "P_TIMEOUT" Ta No "0x00400 Timing out during sleep" 204.It Dv "P_TRACED" Ta No "0x00800 Debugged process being traced" 205.It Dv "P_WAITED" Ta No "0x01000 Debugging process has waited for child" 206.It Dv "P_WEXIT" Ta No "0x02000 Working on exiting" 207.It Dv "P_EXEC" Ta No "0x04000 Process called exec" 208.It Dv "P_NOSWAP" Ta No "0x08000 Another flag to prevent swap out" 209.It Dv "P_PHYSIO" Ta No "0x10000 Doing physical I/O" 210.It Dv "P_OWEUPC" Ta No "0x20000 Owe process an addupc() call at next ast" 211.It Dv "P_SWAPPING" Ta No "0x40000 Process is being swapped" 212.El 213.It lim 214The soft limit on memory used, specified via a call to 215.Xr setrlimit 2 . 216.It lstart 217The exact time the command started, using the ``%C'' format described in 218.Xr strftime 3 . 219.It nice 220The process scheduling increment (see 221.Xr setpriority 2 ) . 222.It rss 223the real memory (resident set) size of the process (in 1024 byte units). 224.It start 225The time the command started. 226If the command started less than 24 hours ago, the start time is 227displayed using the ``%l:ps.1p'' format described in 228.Xr strftime 3 . 229If the command started less than 7 days ago, the start time is 230displayed using the ``%a6.15p'' format. 231Otherwise, the start time is displayed using the ``%e%b%y'' format. 232.It state 233The state is given by a sequence of letters, for example, 234.Dq Tn RWNA . 235The first letter indicates the run state of the process: 236.Pp 237.Bl -tag -width indent -compact 238.It D 239Marks a process in disk (or other short term, uninterruptible) wait. 240.It I 241Marks a process that is idle (sleeping for longer than about 20 seconds). 242.It R 243Marks a runnable process. 244.It S 245Marks a process that is sleeping for less than about 20 seconds. 246.It T 247Marks a stopped process. 248.It Z 249Marks a dead process (a ``zombie''). 250.El 251.Pp 252Additional characters after these, if any, indicate additional state 253information: 254.Pp 255.Bl -tag -width indent -compact 256.It + 257The process is in the foreground process group of its control terminal. 258.It < 259The process has raised 260.Tn CPU 261scheduling priority. 262.It > 263The process has specified a soft limit on memory requirements and is 264currently exceeding that limit; such a process is (necessarily) not 265swapped. 266.It A 267the process has asked for random page replacement 268.Pf ( Dv VA_ANOM , 269from 270.Xr vadvise 2 , 271for example, 272.Xr lisp 1 273in a garbage collect). 274.It E 275The process is trying to exit. 276.It L 277The process has pages locked in core (for example, for raw 278.Tn I/O ) . 279.It N 280The process has reduced 281.Tn CPU 282scheduling priority (see 283.Xr setpriority 2 ) . 284.It S 285The process has asked for 286.Tn FIFO 287page replacement 288.Pf ( Dv VA_SEQL , 289from 290.Xr vadvise 2 , 291for example, a large image processing program using virtual memory to 292sequentially address voluminous data). 293.It s 294The process is a session leader. 295.It V 296The process is suspended during a 297.Xr vfork . 298.It W 299The process is swapped out. 300.It X 301The process is being traced or debugged. 302.El 303.It tt 304An abbreviation for the pathname of the controlling terminal, if any. 305The abbreviation consists of the two letters following 306.Dq Pa /dev/tty , 307or, for the console, ``co''. 308This is followed by a ``-'' if the process can no longer reach that 309controlling terminal (i.e., it has been revoked). 310.It wchan 311The event (an address in the system) on which a process waits. 312When printed numerically, the initial part of the address is 313trimmed off and the result is printed in hex, for example, 0x80324000 prints 314as 324000. 315.El 316.Pp 317When printing using the command keyword, a process that has exited and 318has a parent that has not yet waited for the process (in other words, a zombie) 319is listed as ``<defunct>'', and a process which is blocked while trying 320to exit is listed as ``<exiting>''. 321.Nm \&Ps 322makes an educated guess as to the file name and arguments given when the 323process was created by examining memory or the swap area. 324The method is inherently somewhat unreliable and in any event a process 325is entitled to destroy this information, so the names cannot be depended 326on too much. 327The ucomm (accounting) keyword can, however, be depended on. 328.Sh KEYWORDS 329The following is a complete list of the available keywords and their 330meanings. 331Several of them have aliases (keywords which are synonyms). 332.Pp 333.Bl -tag -width sigignore -compact 334.It %cpu 335percentage cpu usage (alias pcpu) 336.It %mem 337percentage memory usage (alias pmem) 338.It acflag 339accounting flag (alias acflg) 340.It command 341command and arguments 342.It cpu 343short-term cpu usage factor (for scheduling) 344.It flags 345the process flags, in hexadecimal (alias f) 346.It inblk 347total blocks read (alias inblock) 348.It jobc 349job control count 350.It ktrace 351tracing flags 352.It ktracep 353tracing vnode 354.It lim 355memoryuse limit 356.It logname 357login name of user who started the process 358.It lstart 359time started 360.It majflt 361total page faults 362.It minflt 363total page reclaims 364.It msgrcv 365total messages received (reads from pipes/sockets) 366.It msgsnd 367total messages sent (writes on pipes/sockets) 368.It nice 369nice value (alias ni) 370.It nivcsw 371total involuntary context switches 372.It nsigs 373total signals taken (alias nsignals) 374.It nswap 375total swaps in/out 376.It nvcsw 377total voluntary context switches 378.It nwchan 379wait channel (as an address) 380.It oublk 381total blocks written (alias oublock) 382.It p_ru 383resource usage (valid only for zombie) 384.It paddr 385swap address 386.It pagein 387pageins (same as majflt) 388.It pgid 389process group number 390.It pid 391process 392.Tn ID 393.It poip 394pageouts in progress 395.It ppid 396parent process 397.Tn ID 398.It pri 399scheduling priority 400.It re 401core residency time (in seconds; 127 = infinity) 402.It rgid 403real group 404.Tn ID 405.It rlink 406reverse link on run queue, or 0 407.It rss 408resident set size 409.It rsz 410resident set size + (text size / text use count) (alias rssize) 411.It rtprio 412realtime priority (101 = not a realtime process) 413.It ruid 414real user 415.Tn ID 416.It ruser 417user name (from ruid) 418.It sess 419session pointer 420.It sig 421pending signals (alias pending) 422.It sigcatch 423caught signals (alias caught) 424.It sigignore 425ignored signals (alias ignored) 426.It sigmask 427blocked signals (alias blocked) 428.It sl 429sleep time (in seconds; 127 = infinity) 430.It start 431time started 432.It state 433symbolic process state (alias stat) 434.It svgid 435saved gid from a setgid executable 436.It svuid 437saved uid from a setuid executable 438.It tdev 439control terminal device number 440.It time 441accumulated cpu time, user + system (alias cputime) 442.It tpgid 443control terminal process group 444.Tn ID 445.\".It trss 446.\"text resident set size (in Kbytes) 447.It tsess 448control terminal session pointer 449.It tsiz 450text size (in Kbytes) 451.It tt 452control terminal name (two letter abbreviation) 453.It tty 454full name of control terminal 455.It uprocp 456process pointer 457.It ucomm 458name to be used for accounting 459.It uid 460effective user 461.Tn ID 462.It upr 463scheduling priority on return from system call (alias usrpri) 464.It user 465user name (from uid) 466.It vsz 467virtual size in Kbytes (alias vsize) 468.It wchan 469wait channel (as a symbolic name) 470.It xstat 471exit or stop status (valid only for stopped or zombie process) 472.El 473.Sh FILES 474.Bl -tag -width /var/db/kvm_kernel.db -compact 475.It Pa /dev 476special files and device names 477.It Pa /dev/drum 478default swap device 479.It Pa /dev/kmem 480default kernel memory 481.It Pa /var/run/dev.db 482/dev name database 483.It Pa /var/db/kvm_kernel.db 484system namelist database 485.It Pa /kernel 486default system namelist 487.It Pa /proc 488the mount point of 489.Xr procfs 5 490.El 491.Sh SEE ALSO 492.Xr kill 1 , 493.Xr w 1 , 494.Xr kvm 3 , 495.Xr strftime 3 , 496.Xr procfs 5 , 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