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