Commit | Line | Data |
---|---|---|
dd9e2e8d | 1 | .\" Copyright (c) 1980, 1990 The Regents of the University of California. |
b5dc1377 CL |
2 | .\" All rights reserved. |
3 | .\" | |
4 | .\" %sccs.include.redist.man% | |
5 | .\" | |
dd9e2e8d | 6 | .\" @(#)ps.1 6.7 (Berkeley) %G% |
b5dc1377 CL |
7 | .\" |
8 | .Dd | |
dd9e2e8d | 9 | .Dd |
b5dc1377 CL |
10 | .Dt PS 1 |
11 | .Os BSD 4 | |
12 | .Sh NAME | |
13 | .Nm ps | |
14 | .Nd display current process status | |
15 | .Sh SYNOPSIS | |
16 | .Nm ps | |
17 | .Op Fl acegklnstuvwxU\&\#\& | |
18 | .Sh DESCRIPTION | |
19 | .Nm Ps | |
20 | displays the current process status. | |
24115aa8 | 21 | Normally, only your processes are candidates to be printed by |
b5dc1377 | 22 | .Nm ps ; |
24115aa8 | 23 | specifying |
b5dc1377 | 24 | .Fl a |
c3f41f75 | 25 | causes other users' processes to be candidates to be printed; |
24115aa8 | 26 | specifying |
b5dc1377 | 27 | .Fl x |
24115aa8 | 28 | includes processes without control terminals in the candidate pool. |
b5dc1377 CL |
29 | While |
30 | .Nm ps | |
31 | is a fairly accurate snapshot of the system, | |
32 | .Nm Ps | |
33 | cannot begin and finish a snapshot of the system as fast as some processes | |
34 | themselves change state. At times there may be minor discrepancies. | |
35 | .Pp | |
24115aa8 KM |
36 | All output formats include, for each process, the process id PID, |
37 | control terminal of the process TT, cpu time used by the process TIME | |
38 | (this includes both user and system time), the state STAT of the process, | |
39 | and an indication of the COMMAND which is running. | |
d6cf0c8b | 40 | The state is given by a sequence of letters, e.g. ``RWNA''. |
24115aa8 KM |
41 | The first letter indicates the runnability of the process: |
42 | R for runnable processes, | |
43 | T for stopped processes, | |
44 | P for processes in page wait, | |
45 | D for those in disk (or other short term) waits, | |
46 | S for those sleeping for less than about 20 seconds, | |
47 | and I for idle (sleeping longer than about 20 seconds) | |
48 | processes. | |
d6cf0c8b MK |
49 | Additional characters after these, if any, |
50 | indicate additional state information. | |
51 | The letter W indicates that a process is swapped out, | |
52 | showing W if it is, or a blank if it is loaded (in-core). | |
53 | A process which has specified a soft limit on memory requirements | |
24115aa8 KM |
54 | and which is exceeding that limit shows >; such a process is (necessarily) |
55 | not swapped. | |
d6cf0c8b | 56 | An additional letter may indicate whether a process is running with altered |
dee48434 KM |
57 | CPU scheduling priority (nice); if the process priority is reduced, |
58 | an N is shown, if the process priority has been artificially raised then | |
d6cf0c8b MK |
59 | a `<' is shown. |
60 | The final optional letter | |
61 | indicates any special treatment of the process for virtual | |
24115aa8 | 62 | memory replacement; the letters correspond to options to the |
b5dc1377 CL |
63 | .Xr vadvise 2 |
64 | call; currently the possibilities are A standing for VA_ANOM and | |
d6cf0c8b MK |
65 | S for VA_SEQL. |
66 | An A typically represents a | |
b5dc1377 | 67 | .Xr lisp 1 |
d6cf0c8b | 68 | in garbage collection, and S is typical of large image processing programs |
24115aa8 | 69 | which are using virtual memory to sequentially address voluminous data. |
b5dc1377 | 70 | .Pp |
24115aa8 | 71 | Here are the options: |
b5dc1377 CL |
72 | .Tp Fl a |
73 | asks for information regarding processes associated with terminals (ordinarily | |
24115aa8 | 74 | only one's own processes are displayed). |
b5dc1377 | 75 | .Tp Fl c |
24115aa8 KM |
76 | prints the command name, as stored internally in the system for purposes |
77 | of accounting, rather than the command arguments, which are kept | |
78 | in the process' address space. This is more reliable, if less informative, | |
79 | since the process is free to destroy the latter information. | |
b5dc1377 | 80 | .Tp Fl e |
24115aa8 | 81 | Asks for the environment to be printed as well as the arguments to the command. |
b5dc1377 | 82 | .Tp Fl g |
24115aa8 KM |
83 | Asks for all processes. |
84 | Without this option, | |
b5dc1377 | 85 | .Nm ps |
24115aa8 KM |
86 | only prints ``interesting'' processes. |
87 | Processes are deemed to be uninteresting if they are process group leaders. | |
88 | This normally eliminates top-level command interpreters and processes | |
89 | waiting for users to login on free terminals. | |
b5dc1377 | 90 | .Tp Fl k |
24115aa8 | 91 | causes the file |
b5dc1377 CL |
92 | .Pa /vmcore |
93 | to be used instead of | |
94 | .Pa /dev/kmem | |
95 | and | |
96 | .Ar /dev/mem | |
97 | for non-interactive (after the fact) | |
98 | debugging. | |
99 | .Tp Fl l | |
100 | asks for a detailed list, with fields PPID, CP, PRI, NI, ADDR, SIZE, RSS and | |
24115aa8 | 101 | WCHAN as described below. |
b5dc1377 | 102 | .Tp Fl n |
53829504 KM |
103 | Asks for numerical output. |
104 | In a long listing, the WCHAN field is printed numerically rather than | |
105 | symbolically, or, in a user listing, the USER field is replaced by a | |
106 | UID field. | |
b5dc1377 | 107 | .Tp Fl s |
24115aa8 KM |
108 | Adds the size SSIZ of the kernel stack of each process (for use by system |
109 | maintainers) to the basic output format. | |
b5dc1377 CL |
110 | .Ct Fl t |
111 | .Ar x | |
112 | .Cx | |
113 | Only output information on processes whose controlling tty is | |
114 | .Ar x | |
24115aa8 | 115 | (which should be specified as printed by |
b5dc1377 | 116 | .Nm ps , |
24115aa8 | 117 | e.g. |
b5dc1377 | 118 | .Ar t3 |
24115aa8 | 119 | for tty3, |
b5dc1377 | 120 | .Ar tco |
24115aa8 | 121 | for console, |
b5dc1377 | 122 | .Ar td0 |
24115aa8 | 123 | for ttyd0, |
b5dc1377 | 124 | .Ar t ? |
24115aa8 | 125 | for processes with no tty, |
b5dc1377 | 126 | .Ar t |
dee48434 | 127 | for processes at the current tty, |
24115aa8 KM |
128 | etc). |
129 | This option must be the last one given. | |
b5dc1377 | 130 | .Tp Fl u |
24115aa8 KM |
131 | A user oriented output is produced. |
132 | This includes fields USER, %CPU, NICE, SIZE, and RSS as described below. | |
b5dc1377 | 133 | .Tp Fl v |
24115aa8 KM |
134 | A version of the output containing virtual memory statistics is output. |
135 | This includes fields RE, SL, PAGEIN, SIZE, RSS, LIM, TSIZ, TRS, %CPU | |
136 | and %MEM, described below. | |
b5dc1377 | 137 | .Tp Fl w |
24115aa8 KM |
138 | Use a wide output format (132 columns rather than 80); if repeated, |
139 | e.g. ww, use arbitrarily wide output. | |
140 | This information is used to decide how much of long commands to print. | |
b5dc1377 | 141 | .Tp Fl x |
24115aa8 | 142 | asks even about processes with no terminal. |
b5dc1377 | 143 | .Tp Fl U |
3e284fd6 | 144 | causes ps to update a private database where it keeps system |
b5dc1377 CL |
145 | information. Thus ``ps U'' should be included in the |
146 | .Pa /etc/rc | |
147 | file. | |
148 | .Tp Fl # | |
24115aa8 KM |
149 | A process number may be given, |
150 | (indicated here by #), | |
151 | in which case the output | |
152 | is restricted to that process. | |
153 | This option must also be last. | |
b5dc1377 CL |
154 | .Tp |
155 | .Pp | |
156 | A second argument is taken | |
dee48434 KM |
157 | to be the file containing the system's |
158 | namelist. Otherwise, /vmunix is used. | |
159 | A third argument tells | |
b5dc1377 | 160 | .Nm ps |
24115aa8 | 161 | where to look for |
b5dc1377 | 162 | .Pa core |
24115aa8 | 163 | if the |
b5dc1377 CL |
164 | .Fl k |
165 | option is given, instead of | |
166 | .Pa /vmcore . | |
dee48434 KM |
167 | If a fourth argument is given, it |
168 | is taken to be the name of a swap file to use instead of | |
b5dc1377 CL |
169 | the default |
170 | .Pa /dev/drum . | |
171 | .Pp | |
24115aa8 | 172 | Fields which are not common to all output formats: |
b5dc1377 CL |
173 | .Pp |
174 | .Dw PAGEIN | |
175 | .Dp Li USER | |
24115aa8 | 176 | name of the owner of the process |
b5dc1377 | 177 | .Dp Li %CPU |
24115aa8 KM |
178 | cpu utilization of the process; this is a decaying average over up to |
179 | a minute of previous (real) time. Since the time base over which this | |
180 | is computed varies (since processes may be very young) it is possible | |
181 | for the sum of all %CPU fields to exceed 100%. | |
b5dc1377 | 182 | .Dp Li NICE |
24115aa8 | 183 | (or NI) process scheduling increment (see |
b5dc1377 CL |
184 | .Xr setpriority 2 ) |
185 | .Dp Li SIZE | |
24115aa8 | 186 | virtual size of the process (in 1024 byte units) |
b5dc1377 | 187 | .Dp Li RSS |
24115aa8 | 188 | real memory (resident set) size of the process (in 1024 byte units) |
b5dc1377 | 189 | .Dp Li LIM |
24115aa8 | 190 | soft limit on memory used, specified via a call to |
b5dc1377 CL |
191 | .Xr setrlimit 2 ; |
192 | if no limit has been specified then shown as | |
193 | .Ar xx | |
194 | .Dp Li TSIZ | |
24115aa8 | 195 | size of text (shared program) image |
b5dc1377 | 196 | .Dp Li TRS |
24115aa8 | 197 | size of resident (real memory) set of text |
b5dc1377 | 198 | .Dp Li %MEM |
24115aa8 | 199 | percentage of real memory used by this process. |
b5dc1377 | 200 | .Dp Li RE |
24115aa8 | 201 | residency time of the process (seconds in core) |
b5dc1377 | 202 | .Dp Li SL |
24115aa8 | 203 | sleep time of the process (seconds blocked) |
b5dc1377 | 204 | .Dp Li PAGEIN |
24115aa8 KM |
205 | number of disk i/o's resulting from references by the process |
206 | to pages not loaded in core. | |
b5dc1377 CL |
207 | .Dp Li UID |
208 | process owner's user-id (numerical) | |
209 | .Dp Li PPID | |
210 | parent process id (numerical) | |
211 | .Dp Li CP | |
24115aa8 | 212 | short-term cpu utilization factor (used in scheduling) |
b5dc1377 | 213 | .Dp Li PRI |
24115aa8 | 214 | process priority (non-positive when in non-interruptible wait) |
b5dc1377 | 215 | .Dp Li ADDR |
24115aa8 | 216 | swap address of the process |
b5dc1377 CL |
217 | .Dp Li WCHAN |
218 | address of event on which a process is waiting (an address in the system). | |
53829504 | 219 | A symbol is chosen that classifies the address, unless numerical |
b5dc1377 CL |
220 | output is requested (see the |
221 | .Fl n | |
53829504 KM |
222 | flag). |
223 | In this case, the initial part of the address is | |
224 | trimmed off and is printed hexadecimally, e.g., 0x80004000 prints as 4000. | |
b5dc1377 CL |
225 | .Pp |
226 | .Dp Li F | |
dee48434 | 227 | flags associated with process as in |
b5dc1377 CL |
228 | .Aq Pa sys/proc.h : |
229 | .Pp | |
230 | .Cw SDETACH 080000 | |
231 | .Cl SLOAD 000001 in core | |
232 | .Cl SSYS 000002 swapper or pager process | |
233 | .Cl SLOCK 000004 swapping out process | |
234 | .Cl SSWAP 000008 save area flag | |
235 | .Cl STRC 000010 tracing the process | |
236 | .Cl SWTED 000020 trace flag | |
237 | .Cl SULOCK 000040 user settable lock in core | |
238 | .Cl SPAGE 000080 process in page wait state | |
239 | .Cl SKEEP 000100 another flag to prevent swap out | |
240 | .Cl SDLYU 000200 delayed unlock of pages | |
241 | .Cl SWEXIT 000400 working on exiting | |
242 | .Cl SPHYSIO 000800 doing physical i/o (bio.c) | |
243 | .Cl SVFORK 001000 process resulted from vfork() | |
244 | .Cl SVFDONE 002000 another vfork flag | |
245 | .Cl SNOVM 004000 no vm, parent in a vfork() | |
246 | .Cl SPAGI 008000 init data space on demand from inode | |
247 | .Cl SANOM 010000 system detected anomalous vm behavior | |
248 | .Cl SUANOM 020000 user warned of anomalous vm behavior | |
249 | .Cl STIMO 040000 timing out during sleep | |
250 | .Cl SDETACH 080000 detached inherited by init | |
251 | .Cl SOUSIG 100000 using old signal mechanism | |
252 | .Cw | |
253 | .Dp | |
254 | .Pp | |
255 | .Tp Aq Li defunct | |
256 | A | |
257 | .Aq defunct | |
258 | process is one that has exited, but whose parent process has | |
259 | not waited for it. | |
c3f41f75 | 260 | A process that has exited and has a parent that has not |
b5dc1377 CL |
261 | yet waited for the process is marked |
262 | .Aq Li defunct . | |
263 | .Tp Aq Li exiting | |
264 | A process | |
265 | which is blocked trying to exit is marked | |
266 | .Aq Li exiting | |
267 | .Tp | |
268 | .Pp | |
269 | .Nm Ps | |
24115aa8 KM |
270 | makes an educated guess as to the file name |
271 | and arguments given when the process was created | |
272 | by examining memory or the swap area. | |
273 | The method is inherently somewhat unreliable and in any event | |
274 | a process is entitled to destroy this information, | |
275 | so the names cannot be counted on too much. | |
b5dc1377 CL |
276 | .Sh FILES |
277 | .Dw /etc/pasdatabase | |
278 | .Di L | |
279 | .Dp Pa /vmunix | |
280 | system namelist | |
281 | .Dp Pa /dev/kmem | |
282 | kernel memory | |
283 | .Dp Pa /dev/drum | |
284 | swap device | |
285 | .Dp Pa /vmcore | |
286 | core file | |
287 | .Dp Pa /dev | |
288 | searched to find swap device and tty names | |
289 | .\" .Dp Pa /etc/psdatabase | |
290 | .\" system namelist, device, and wait channel information | |
291 | .Dp | |
292 | .Sh SEE ALSO | |
293 | .Xr kill 1 , | |
294 | .Xr w 1 | |
295 | .Sh HISTORY | |
296 | A | |
297 | .Nm Ps | |
298 | command appeared in VERSION 6 AT&T UNIX. |