1.\" $NetBSD: ps.1,v 1.21 1997/10/11 02:16:56 enami Exp $ 2.\" 3.\" Copyright (c) 1980, 1990, 1991, 1993, 1994 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. All advertising materials mentioning features or use of this software 15.\" must display the following acknowledgement: 16.\" This product includes software developed by the University of 17.\" California, Berkeley and its contributors. 18.\" 4. Neither the name of the University nor the names of its contributors 19.\" may be used to endorse or promote products derived from this software 20.\" without specific prior written permission. 21.\" 22.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 23.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 24.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 26.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 28.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 29.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 30.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 31.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32.\" SUCH DAMAGE. 33.\" 34.\" @(#)ps.1 8.3 (Berkeley) 4/18/94 35.\" 36.Dd April 18, 1994 37.Dt PS 1 38.Os BSD 4 39.Sh NAME 40.Nm ps 41.Nd process status 42.Sh SYNOPSIS 43.Nm 44.Op Fl acCehjlmrSTuvwx 45.Op Fl M Ar core 46.Op Fl N Ar system 47.Op Fl O Ar fmt 48.Op Fl o Ar fmt 49.Op Fl p Ar pid 50.Op Fl t Ar tty 51.Op Fl W Ar swap 52.Nm "" 53.Op Fl L 54.Sh DESCRIPTION 55.Nm 56displays a header line followed by lines containing information about your 57processes that have controlling terminals. 58This information is sorted 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 options are as follows: 73.Bl -tag -width indent 74.It Fl a 75Display information about other users' processes as well as your own. 76.It Fl c 77Do not display full command with arguments, but only the 78executable name. 79This may be somewhat confusing; for example, all 80.Xr sh 1 81scripts will show as 82.Dq sh . 83.It Fl C 84Change the way the cpu percentage is calculated by using a ``raw'' 85cpu calculation that ignores ``resident'' time (this normally has 86no effect). 87.It Fl e 88Display the environment as well. 89.It Fl h 90Repeat the information header as often as necessary to guarantee one 91header per page of information. 92.It Fl j 93Print information associated with the following keywords: 94user, pid, ppid, pgid, sess, jobc, state, tt, time and command. 95.It Fl L 96List the set of available keywords. 97.It Fl l 98Display information associated with the following keywords: 99uid, pid, ppid, cpu, pri, nice, vsz, rss, wchan, state, tt, time 100and command. 101.It Fl M 102Extract values associated with the name list from the specified core 103instead of the default 104.Dq Pa /dev/kmem . 105.It Fl m 106Sort by memory usage, instead of by process 107.Tn ID . 108.It Fl N 109Extract the name list from the specified system instead of the default 110.Dq Pa /netbsd . 111.It Fl O 112Add the information associated with the space or comma separated list 113of keywords specified, after the process 114.Tn ID , 115in the default information 116display. 117Keywords may be appended with an equals (``='') sign and a string. 118This causes the printed header to use the specified string instead of 119the standard header. 120.It Fl o 121Display information associated with the space or comma separated list 122of keywords specified. 123Keywords may be appended with an equals (``='') sign and a string. 124This causes the printed header to use the specified string instead of 125the standard header. 126.It Fl p 127Display information associated with the specified process 128.Tn ID . 129.It Fl r 130Sort by current cpu usage, instead of by process 131.Tn ID . 132.It Fl S 133Change the way the process time is calculated by summing all exited 134children to their parent process. 135.It Fl T 136Display information about processes attached to the device associated 137with the standard input. 138.It Fl t 139Display information about processes attached to the specified terminal 140device. 141.It Fl u 142Display information associated with the following keywords: 143user, pid, %cpu, %mem, vsz, rss, tt, state, start, time and command. 144The 145.Fl u 146option implies the 147.Fl r 148option. 149.It Fl v 150Display information associated with the following keywords: 151pid, state, time, sl, re, pagein, vsz, rss, lim, tsiz, 152%cpu, %mem and command. 153The 154.Fl v 155option implies the 156.Fl m 157option. 158.It Fl W 159Extract swap information from the specified file instead of the 160default 161.Dq Pa /dev/drum . 162.It Fl w 163Use 132 columns to display information, instead of the default which 164is your window size. 165If the 166.Fl w 167option is specified more than once, 168.Nm 169will use as many columns as necessary without regard for your window size. 170.It Fl x 171Display information about processes without controlling terminals. 172.El 173.Pp 174A complete list of the available keywords are listed below. 175Some of these keywords are further specified as follows: 176.Bl -tag -width indent 177.It %cpu 178The cpu utilization of the process; this is a decaying average over up to 179a minute of previous (real) time. 180Since the time base over which this is computed varies (since processes may 181be very young) it is possible for the sum of all 182.Tn %CPU 183fields to exceed 100%. 184.It %mem 185The percentage of real memory used by this process. 186.It flags 187The flags (in hexadecimal) associated with the process as in 188the include file 189.Aq Pa sys/proc.h : 190.Bl -column P_NOCLDSTOP P_NOCLDSTOP 191.It Dv "P_ADVLOCK" Ta No "0x0000001 process may hold a POSIX advisory lock" 192.It Dv "P_CONTROLT" Ta No "0x0000002 process has a controlling terminal" 193.It Dv "P_INMEM" Ta No "0x0000004 process is loaded into memory" 194.It Dv "P_NOCLDSTOP" Ta No "0x0000008 no 195.Dv SIGCHLD 196when children stop 197.It Dv "P_PPWAIT" Ta No "0x0000010 parent is waiting for child to exec/exit" 198.It Dv "P_PROFIL" Ta No "0x0000020 process has started profiling" 199.It Dv "P_SELECT" Ta No "0x0000040 selecting; wakeup/waiting danger" 200.It Dv "P_SINTR" Ta No "0x0000080 sleep is interruptible" 201.It Dv "P_SUGID" Ta No "0x0000100 process had set id privileges since last exec" 202.It Dv "P_SYSTEM" Ta No "0x0000200 system process: no sigs, stats or swapping" 203.It Dv "P_TIMEOUT" Ta No "0x0000400 timing out during sleep" 204.It Dv "P_TRACED" Ta No "0x0000800 process is being traced" 205.It Dv "P_WAITED" Ta No "0x0001000 debugging process has waited for child" 206.It Dv "P_WEXIT" Ta No "0x0002000 working on exiting" 207.It Dv "P_EXEC" Ta No "0x0004000 process called" 208.Xr execve 2 209.It Dv "P_OWEUPC" Ta No "0x0008000 owe process an addupc() call at next ast" 210.\" the routine addupc is not documented in the man pages 211.It Dv "P_FSTRACE" Ta No "0x0010000 tracing via file system" 212.It Dv "P_SSTEP" Ta No "0x0020000 process needs single-step fixup" 213.El 214.It lim 215The soft limit on memory used, specified via a call to 216.Xr setrlimit 2 . 217.It lstart 218The exact time the command started, using the ``%C'' format described in 219.Xr strftime 3 . 220.It nice 221The process scheduling increment (see 222.Xr setpriority 2 ) . 223.It rss 224the real memory (resident set) size of the process (in 1024 byte units). 225.It start 226The time the command started. 227If the command started less than 24 hours ago, the start time is 228displayed using the ``%l:%M%p'' format described in 229.Xr strftime 3 . 230If the command started less than 7 days ago, the start time is 231displayed using the ``%a%p'' format. 232Otherwise, the start time is displayed using the ``%e%b%y'' format. 233.It state 234The state is given by a sequence of letters, for example, 235.Dq Tn RWNA . 236The first letter indicates the run state of the process: 237.Pp 238.Bl -tag -width indent -compact 239.It D 240Marks a process in disk (or other short term, uninterruptible) wait. 241.It I 242Marks a process that is idle (sleeping for longer than about 20 seconds). 243.It R 244Marks a runnable process. 245.It S 246Marks a process that is sleeping for less than about 20 seconds. 247.It T 248Marks a stopped process. 249.It Z 250Marks a dead process (a ``zombie''). 251.El 252.Pp 253Additional characters after these, if any, indicate additional state 254information: 255.Pp 256.Bl -tag -width indent -compact 257.It + 258The process is in the foreground process group of its control terminal. 259.It < 260The process has raised 261.Tn CPU 262scheduling priority. 263.It > 264The process has specified a soft limit on memory requirements and is 265currently exceeding that limit; such a process is (necessarily) not 266swapped. 267.It A 268the process has asked for random page replacement 269.Pf ( Dv VA_ANOM , 270from 271.Xr vadvise 2 , 272for example, 273.Xr lisp 1 274in a garbage collect). 275.It E 276The process is trying to exit. 277.It L 278The process has pages locked in core (for example, for raw 279.Tn I/O ) . 280.It N 281The process has reduced 282.Tn CPU 283scheduling priority (see 284.Xr setpriority 2 ) . 285.It S 286The process has asked for 287.Tn FIFO 288page replacement 289.Pf ( Dv VA_SEQL , 290from 291.Xr vadvise 2 , 292for example, a large image processing program using virtual memory to 293sequentially address voluminous data). 294.It s 295The process is a session leader. 296.It V 297The process is suspended during a 298.Xr vfork 2 . 299.It W 300The process is swapped out. 301.It X 302The process is being traced or debugged. 303.El 304.It tt 305An abbreviation for the pathname of the controlling terminal, if any. 306The abbreviation consists of the two letters following 307.Dq Pa /dev/tty , 308or, for the console, ``co''. 309This is followed by a ``-'' if the process can no longer reach that 310controlling terminal (i.e., it has been revoked). 311.It wchan 312The event (an address in the system) on which a process waits. 313When printed numerically, the initial part of the address is 314trimmed off and the result is printed in hex, for example, 0x80324000 prints 315as 324000. 316.El 317.Pp 318When printing using the command keyword, a process that has exited and 319has a parent that has not yet waited for the process (in other words, a zombie) 320is listed as ``<defunct>'', and a process which is blocked while trying 321to exit is listed as ``<exiting>''. 322.Nm 323makes an educated guess as to the file name and arguments given when the 324process was created by examining memory or the swap area. 325The method is inherently somewhat unreliable and in any event a process 326is entitled to destroy this information, so the names cannot be depended 327on too much. 328The ucomm (accounting) keyword can, however, be depended on. 329.Sh KEYWORDS 330The following is a complete list of the available keywords and their 331meanings. 332Several of them have aliases (keywords which are synonyms). 333.Pp 334.Bl -tag -width sigignore -compact 335.It %cpu 336percentage cpu usage (alias pcpu) 337.It %mem 338percentage memory usage (alias pmem) 339.It acflag 340accounting flag (alias acflg) 341.It command 342command and arguments 343.It cpu 344short-term cpu usage factor (for scheduling) 345.It flags 346the process flags, in hexadecimal (alias f) 347.It inblk 348total blocks read (alias inblock) 349.It jobc 350job control count 351.It holdcnt 352number of holds on the process (if non-zero, process can't be swapped) 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 ruid 415real user 416.Tn ID 417.It ruser 418user name (from ruid) 419.It sess 420session pointer 421.It sig 422pending signals (alias pending) 423.It sigcatch 424caught signals (alias caught) 425.It sigignore 426ignored signals (alias ignored) 427.It sigmask 428blocked signals (alias blocked) 429.It sl 430sleep time (in seconds; 127 = infinity) 431.It start 432time started 433.It state 434symbolic process state (alias stat) 435.It svgid 436saved gid from a setgid executable 437.It svuid 438saved uid from a setuid executable 439.It tdev 440control terminal device number 441.It time 442accumulated cpu time, user + system (alias cputime) 443.It tpgid 444control terminal process group 445.Tn ID 446.\".It trss 447.\"text resident set size (in Kbytes) 448.It tsess 449control terminal session pointer 450.It tsiz 451text size (in Kbytes) 452.It tt 453control terminal name (two letter abbreviation) 454.It tty 455full name of control terminal 456.It uprocp 457process pointer 458.It ucomm 459name to be used for accounting 460.It uid 461effective user 462.Tn ID 463.It upr 464scheduling priority on return from system call (alias usrpri) 465.It user 466user name (from uid) 467.It vsz 468virtual size in Kbytes (alias vsize) 469.It wchan 470wait channel (as a symbolic name) 471.It xstat 472exit or stop status (valid only for stopped or zombie process) 473.El 474.Sh FILES 475.Bl -tag -width /var/db/kvm_netbsd.db -compact 476.It Pa /dev 477special files and device names 478.It Pa /dev/drum 479default swap device 480.It Pa /dev/kmem 481default kernel memory 482.It Pa /var/run/dev.db 483/dev name database 484.It Pa /var/db/kvm_netbsd.db 485system namelist database 486.It Pa /netbsd 487default system namelist 488.El 489.Sh SEE ALSO 490.Xr kill 1 , 491.Xr sh 1 , 492.Xr w 1 , 493.Xr kvm 3 , 494.Xr strftime 3 , 495.Xr pstat 8 496.Sh BUGS 497Since 498.Nm 499cannot run faster than the system and is run as any other scheduled 500process, the information it displays can never be exact. 501