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