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