xref: /freebsd/bin/ps/ps.1 (revision 24e4dcf4ba5e9dedcf89efd358ea3e1fe5867020)
1.\"-
2.\" SPDX-License-Identifier: BSD-3-Clause
3.\"
4.\" Copyright (c) 1980, 1990, 1991, 1993, 1994
5.\"	The Regents of the University of California.  All rights reserved.
6.\" Copyright (c) 2025 The FreeBSD Foundation
7.\"
8.\" Portions of this documentation were written by Olivier Certner
9.\" <olce@FreeBSD.org> at Kumacom SARL under sponsorship from the FreeBSD
10 \" Foundation.
11.\"
12.\" Redistribution and use in source and binary forms, with or without
13.\" modification, are permitted provided that the following conditions
14.\" are met:
15.\" 1. Redistributions of source code must retain the above copyright
16.\"    notice, this list of conditions and the following disclaimer.
17.\" 2. Redistributions in binary form must reproduce the above copyright
18.\"    notice, this list of conditions and the following disclaimer in the
19.\"    documentation and/or other materials provided with the distribution.
20.\" 3. Neither the name of the University nor the names of its contributors
21.\"    may be used to endorse or promote products derived from this software
22.\"    without specific prior written permission.
23.\"
24.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE.
35.\"
36.Dd July 16, 2025
37.Dt PS 1
38.Os
39.Sh NAME
40.Nm ps
41.Nd process status
42.Sh SYNOPSIS
43.Nm
44.Op Fl -libxo
45.Op Fl AaCcdefHhjlmrSTuvwXxZ
46.Op Fl O Ar fmt
47.Op Fl o Ar fmt
48.Op Fl D Ar up | down | both
49.Op Fl G Ar gid Ns Op , Ns Ar gid Ns Ar ...
50.Op Fl J Ar jid Ns Op , Ns Ar jid Ns Ar ...
51.Op Fl M Ar core
52.Op Fl N Ar system
53.Op Fl p Ar pid Ns Op , Ns Ar pid Ns Ar ...
54.Op Fl t Ar tty Ns Op , Ns Ar tty Ns Ar ...
55.Op Fl U Ar user Ns Op , Ns Ar user Ns Ar ...
56.Nm
57.Op Fl -libxo
58.Fl L
59.Sh DESCRIPTION
60The
61.Nm
62utility displays information about a selection of processes.
63Its traditional text style output consists of a header line followed by one line
64of information per selected process, or possibly multiple ones if using
65.Fl H
66.Pq one per lightweight-process .
67Other output styles can be requested via
68.Fl -libxo .
69.Pp
70By default, only the processes of the calling user, determined by matching their
71effective user ID with that of the
72.Nm
73process, that have controlling terminals are shown.
74A different set of processes can be selected for display by using combinations
75of the
76.Fl A , a , D , G , J , p , T , t , U , X ,
77and
78.Fl x
79options.
80Except for options
81.Fl X
82and
83.Fl x ,
84as soon as one of them appears, it inhibits the default process selection, i.e.,
85the calling user's processes are shown only on request.
86If more than one of these
87.Pq with same exceptions
88appear,
89.Nm
90will select processes as soon as they are matched by at least one of them
91.Pq inclusive OR .
92The
93.Fl X
94option can be independently used to further filter the listed processes to only
95those that have a controlling terminal
96.Po
97except for those selected by
98.Fl p
99.Pc .
100Its opposite,
101.Fl x ,
102forcefully removes that filter.
103If none of
104.Fl X
105and
106.Fl x
107is specified, the implied default behavior is that of
108.Fl X
109unless using another option whose description explicitly says that
110.Fl x
111is implied.
112.Pp
113For each selected process, the default displayed information consists of the
114process' ID, controlling terminal, state, CPU time
115.Pq including both user and system time
116and associated command
117.Po
118see the documentation for the
119.Cm command
120keyword below
121.Pc .
122This information can be tweaked using two groups of options which can be
123combined as needed.
124First, options
125.Fl o
126and
127.Fl O
128add columns with data corresponding to the explicitly passed keywords.
129Available keywords are documented in the
130.Sx KEYWORDS
131section below.
132They can be listed using option
133.Fl L .
134Second, options
135.Fl j , l , u ,
136and
137.Fl v
138designate specific predefined groups of columns, also called canned displays.
139Appearance of any of these options inhibits the default display, replacing it
140all with the requested columns, and in the order options are passed.
141The individual columns requested via a canned display option that have the same
142keyword or an alias to that of some column added by an earlier canned display
143option, or by an explicit
144.Fl O
145or
146.Fl o
147option anywhere on the command line, are suppressed.
148This automatic removal of duplicate data in canned displays is useful for
149slightly tweaking these displays and/or combining multiple ones without having
150to rebuild variants from scratch, e.g., using only
151.Fl o
152options.
153.Pp
154Output information lines are by default sorted first by controlling terminal,
155then by process ID, and then, if
156.Fl H
157has been specified, by lightweight-process (thread) ID.
158The
159.Fl m , r , u ,
160and
161.Fl v
162options will change the sort order.
163If more than one sorting option was given, then the selected processes
164will be sorted by the last sorting option which was specified.
165.Pp
166If the traditional text output (the default) is used, the default output width is that requested by the
167.Ev COLUMNS
168environment variable if present, else the line width of the terminal associated
169to the
170.Nm
171process, if any.
172In all other situations, the output width is unlimited.
173See also the
174.Fl w
175option and the
176.Sx BUGS
177section.
178.Pp
179For backwards compatibility,
180.Nm
181attempts to interpret any positional argument as a process ID, as if specified
182by the
183.Fl p
184option.
185Failure to do so will trigger an error.
186.Nm
187also accepts the old-style BSD options, whose format and effect are left
188undocumented on purpose.
189.Pp
190The options are as follows:
191.Bl -tag -width indent
192.It Fl -libxo
193Generate output via
194.Xr libxo 3
195in a selection of different human and machine readable formats.
196See
197.Xr xo_options 7
198for details on command line arguments.
199The default is the traditional text style output.
200.It Fl A
201Display information about all processes in the system.
202Using this option is strictly equivalent to specifying both
203.Fl a
204and
205.Fl x .
206Please see their description for more information.
207.It Fl a
208Display information about all users' processes.
209It does not, however, list all processes
210.Po
211see
212.Fl A
213and
214.Fl x
215.Pc .
216If the
217.Va security.bsd.see_other_uids
218sysctl is set to zero, this option is honored only if the real user ID of the
219.Nm
220process is 0.
221.It Fl C
222Change the way the CPU percentage is calculated by using a
223.Dq raw
224CPU calculation that ignores
225.Dq resident
226time (this normally has
227no effect).
228.It Fl c
229Change the
230.Dq command
231column output to just contain the executable name,
232rather than the full command line.
233.It Fl D
234Expand the list of selected processes based on the process tree.
235.Dq UP
236will add the ancestor processes,
237.Dq DOWN
238will add the descendant processes, and
239.Dq BOTH
240will add both the ancestor and the descendant processes.
241.Fl D
242does not imply
243.Fl d ,
244but works well with it.
245.It Fl d
246Arrange processes into descendancy order and prefix each command with
247indentation text showing sibling and parent/child relationships as a tree.
248If either of the
249.Fl m
250and
251.Fl r
252options are also used, they control how sibling processes are sorted
253relative to each other.
254Note that this option has no effect if the last column does not have
255.Cm comm ,
256.Cm command
257or
258.Cm ucomm
259as its keyword.
260.It Fl e
261Display the environment as well.
262.It Fl f
263Indicates to print the full command and arguments in
264.Cm command
265columns.
266This is the default behavior on
267.Fx .
268See
269.Fl c
270to turn it off.
271.It Fl G
272Display information about processes whose real group ID matches the specified
273group IDs or names.
274Implies
275.Fl x
276by default.
277.It Fl H
278Show all of the threads associated with each process.
279.It Fl h
280Repeat the information header as often as necessary to guarantee one
281header per page of information.
282.It Fl J
283Display information about processes which match the specified jail IDs.
284This may be either the
285.Cm jid
286or
287.Cm name
288of the jail.
289Use
290.Fl J
291.Sy 0
292to request display of host processes.
293Implies
294.Fl x
295by default.
296.It Fl j
297Print information associated with the following keywords:
298.Cm user , pid , ppid , pgid , sid , jobc , state , tt , time ,
299and
300.Cm command .
301.It Fl L
302List the set of keywords available for the
303.Fl O
304and
305.Fl o
306options.
307.It Fl l
308Display information associated with the following keywords:
309.Cm uid , pid , ppid , cpu , pri , nice , vsz , rss , mwchan , state ,
310.Cm tt , time ,
311and
312.Cm command .
313.It Fl M
314Extract values associated with the name list from the specified core
315instead of the currently running system.
316.It Fl m
317Sort by memory usage, instead of the combination of controlling
318terminal and process ID.
319.It Fl N
320Extract the name list from the specified system instead of the default,
321which is the kernel image the system has booted from.
322.It Fl O
323Save passed columns in a separate list that in the end is grafted just after the
324display's first occurence of the process ID column as specified by other
325options, or the default display if there is none.
326If the display prepared by other options does not include a process ID column,
327the list is inserted at start of the display.
328Further occurences of
329.Fl O
330append to the to-be-grafted list of columns.
331This option takes a space- or comma-separated list of keywords.
332The last keyword in the list may be appended with an equals sign
333.Pq Ql =
334as explained for option
335.Fl o
336and with the same effect.
337.It Fl o
338Display information associated with the space- or comma-separated list of
339keywords specified.
340The last keyword in the list may be appended with an equals sign
341.Pq Ql =
342and a string that spans the rest of the argument, and can contain
343space and comma characters.
344This causes the printed header to use the specified string instead of
345the standard header.
346Multiple keywords may also be given in the form of more than one
347.Fl o
348option.
349So the header texts for multiple keywords can be changed.
350If all keywords have empty header texts, no header line is written.
351.It Fl p
352Display information about processes which match the specified process IDs.
353Processes selected by this option are not subject to being filtered by
354.Fl X .
355.It Fl r
356Sort by current CPU usage, instead of the combination of controlling
357terminal and process ID.
358.It Fl S
359Change the way the process times, namely cputime, systime, and usertime,
360are calculated by summing all exited children to their parent process.
361.It Fl T
362Display information about processes attached to the device associated
363with the standard input.
364.It Fl t
365Display information about processes attached to the specified terminal
366devices.
367Full pathnames, as well as abbreviations (see explanation of the
368.Cm tt
369keyword) can be specified.
370Implies
371.Fl x
372by default.
373.It Fl U
374Display information about processes whose real user ID matches the specified
375user IDs or names.
376Implies
377.Fl x
378by default.
379.It Fl u
380Display information associated with the following keywords:
381.Cm user , pid , %cpu , %mem , vsz , rss , tt , state , start , time ,
382and
383.Cm command .
384The
385.Fl u
386option implies the
387.Fl r
388option.
389.It Fl v
390Display information associated with the following keywords:
391.Cm pid , state , time , sl , re , pagein , vsz , rss , lim , tsiz ,
392.Cm %cpu , %mem ,
393and
394.Cm command .
395The
396.Fl v
397option implies the
398.Fl m
399option.
400.It Fl w
401Use at least 131 columns to display information.
402If
403.Fl w
404is specified more than once,
405.Nm
406will use as many columns as necessary.
407Please see the preamble of this manual page for how the output width is
408initially determined.
409In particular, if the initial output width is unlimited, specifying
410.Fl w
411has no effect.
412Please also consult the
413.Sx BUGS
414section.
415.It Fl X
416When displaying processes selected by other options, skip any processes which do
417not have a controlling terminal, except for those selected through
418.Fl p .
419This is the default behaviour, unless using another option whose description
420explicitly says that
421.Fl x
422is implied.
423.It Fl x
424When displaying processes selected by other options, include processes which do
425not have a controlling terminal.
426This option has the opposite behavior to that of
427.Fl X .
428If both
429.Fl X
430and
431.Fl x
432are specified,
433.Nm
434will obey the last occurence.
435.It Fl Z
436Add
437.Xr mac 4
438label to the list of keywords for which
439.Nm
440will display information.
441.El
442.Sh KEYWORDS
443The following is a complete list of the available keywords and their meanings.
444Several of them have aliases (keywords which are synonyms).
445Detailed descriptions for some of them can be found after this list.
446.Pp
447.Bl -tag -width ".Cm sigignore" -compact
448.It Cm %cpu
449percentage CPU usage (alias
450.Cm pcpu )
451.It Cm %mem
452percentage memory usage (alias
453.Cm pmem )
454.It Cm acflag
455accounting flag (alias
456.Cm acflg )
457.It Cm args
458command and arguments
459.It Cm class
460login class
461.It Cm comm
462command
463.It Cm command
464command and arguments
465.It Cm cow
466number of copy-on-write faults
467.It Cm cpu
468The processor number on which the process is executing (visible only on SMP
469systems).
470.It Cm dsiz
471data size in KiB
472.It Cm emul
473system-call emulation environment (ABI)
474.It Cm etime
475elapsed running time, format
476.Do
477.Op days- Ns
478.Op hours\&: Ns
479minutes:seconds
480.Dc
481.It Cm etimes
482elapsed running time, in decimal integer seconds
483.It Cm fib
484default FIB number, see
485.Xr setfib 1
486.It Cm flags
487the process flags, in hexadecimal (alias
488.Cm f )
489.It Cm flags2
490the additional set of process flags, in hexadecimal (alias
491.Cm f2 )
492.It Cm gid
493effective group ID (alias
494.Cm egid )
495.It Cm group
496group name (from egid) (alias
497.Cm egroup )
498.It Cm inblk
499total blocks read (alias
500.Cm inblock )
501.It Cm jail
502jail name
503.It Cm jid
504jail ID
505.It Cm jobc
506job control count
507.It Cm ktrace
508tracing flags
509.It Cm label
510MAC label
511.It Cm lim
512memoryuse limit
513.It Cm lockname
514lock currently blocked on (as a symbolic name)
515.It Cm logname
516login name of user who started the session
517.It Cm lstart
518time started
519.It Cm lwp
520thread (light-weight process) ID (alias
521.Cm tid )
522.It Cm majflt
523total page faults
524.It Cm minflt
525total page reclaims
526.It Cm msgrcv
527total messages received (reads from pipes/sockets)
528.It Cm msgsnd
529total messages sent (writes on pipes/sockets)
530.It Cm mwchan
531wait channel or lock currently blocked on
532.It Cm nice
533nice value (alias
534.Cm ni )
535.It Cm nivcsw
536total involuntary context switches
537.It Cm nlwp
538number of threads (light-weight processes) tied to a process
539.It Cm nsigs
540total signals taken (alias
541.Cm nsignals )
542.It Cm nswap
543total swaps in/out
544.It Cm nvcsw
545total voluntary context switches
546.It Cm nwchan
547wait channel (as an address)
548.It Cm oublk
549total blocks written (alias
550.Cm oublock )
551.It Cm paddr
552process pointer
553.It Cm pagein
554pageins (same as majflt)
555.It Cm pgid
556process group number
557.It Cm pid
558process ID
559.It Cm ppid
560parent process ID
561.It Cm pri
562scheduling priority
563.It Cm re
564core residency time (in seconds; 127 = infinity)
565.It Cm rgid
566real group ID
567.It Cm rgroup
568group name (from rgid)
569.It Cm rss
570resident set size in KiB
571.It Cm rtprio
572realtime priority (see
573.Xr rtprio 1)
574.It Cm ruid
575real user ID
576.It Cm ruser
577user name (from ruid)
578.It Cm sid
579session ID
580.It Cm sig
581pending signals (alias
582.Cm pending )
583.It Cm sigcatch
584caught signals (alias
585.Cm caught )
586.It Cm sigignore
587ignored signals (alias
588.Cm ignored )
589.It Cm sigmask
590blocked signals (alias
591.Cm blocked )
592.It Cm sl
593sleep time (in seconds; 127 = infinity)
594.It Cm ssiz
595stack size in KiB
596.It Cm start
597time started
598.It Cm state
599symbolic process state (alias
600.Cm stat )
601.It Cm svgid
602saved gid from a setgid executable
603.It Cm svuid
604saved UID from a setuid executable
605.It Cm systime
606accumulated system CPU time
607.It Cm tdaddr
608thread address
609.It Cm tdname
610thread name
611.It Cm tdev
612control terminal device number
613.It Cm time
614accumulated CPU time, user + system (alias
615.Cm cputime )
616.It Cm tpgid
617control terminal process group ID
618.It Cm tracer
619tracer process ID
620.\".It Cm trss
621.\"text resident set size in KiB
622.It Cm tsid
623control terminal session ID
624.It Cm tsiz
625text size in KiB
626.It Cm tt
627control terminal name (two letter abbreviation)
628.It Cm tty
629full name of control terminal
630.It Cm ucomm
631process name used for accounting
632.It Cm uid
633effective user ID (alias
634.Cm euid )
635.It Cm upr
636scheduling priority on return from system call (alias
637.Cm usrpri )
638.It Cm uprocp
639process pointer
640.It Cm user
641user name (from UID)
642.It Cm usertime
643accumulated user CPU time
644.It Cm vmaddr
645vmspace pointer
646.It Cm vsz
647virtual size in KiB (alias
648.Cm vsize )
649.It Cm wchan
650wait channel (as a symbolic name)
651.It Cm xstat
652exit or stop status (valid only for stopped or zombie process)
653.El
654.Pp
655Some of these keywords are further specified as follows:
656.Bl -tag -width lockname
657.It Cm %cpu
658The CPU utilization of the process; this is a decaying average over up to
659a minute of previous (real) time.
660Since the time base over which this is computed varies (since processes may
661be very young) it is possible for the sum of all
662.Cm %cpu
663fields to exceed 100%.
664.It Cm %mem
665The percentage of real memory used by this process.
666.It Cm class
667Login class associated with the process.
668.It Cm command
669The printed command and arguments are determined as follows.
670A process that has exited and has a parent that has not yet waited for the
671process (in other words, a zombie) is listed as
672.Dq Li <defunct>.
673If the arguments cannot be located
674.Po
675usually because they have not been set, as is the case for system processes
676and/or kernel threads
677.Pc ,
678the command name is printed within square brackets.
679The
680.Nm
681utility first tries to obtain the arguments cached by the kernel
682.Po
683if they were shorter than the value of the
684.Va kern.ps_arg_cache_limit
685sysctl
686.Pc .
687The process can change the arguments shown with
688.Xr setproctitle 3 .
689Otherwise,
690.Nm
691makes an educated guess as to the file name and arguments given when the
692process was created by examining memory or the swap area.
693The method is inherently somewhat unreliable and in any event a process
694is entitled to destroy this information.
695The
696.Cm ucomm
697keyword
698.Pq accounting
699can, however, be depended on.
700If the arguments are unavailable or do not agree with the
701.Cm ucomm
702keyword, the value for the
703.Cm ucomm
704keyword is appended to the arguments in parentheses.
705.It Cm flags
706The flags associated with the process as in
707the include file
708.In sys/proc.h :
709.Bl -column P_SINGLE_BOUNDARY 0x40000000
710.It Dv "P_ADVLOCK" Ta No "0x00000001" Ta "Process may hold a POSIX advisory lock"
711.It Dv "P_CONTROLT" Ta No "0x00000002" Ta "Has a controlling terminal"
712.It Dv "P_KPROC" Ta No "0x00000004" Ta "Kernel process"
713.It Dv "P_PPWAIT" Ta No "0x00000010" Ta "Parent is waiting for child to exec/exit"
714.It Dv "P_PROFIL" Ta No "0x00000020" Ta "Has started profiling"
715.It Dv "P_STOPPROF" Ta No "0x00000040" Ta "Has thread in requesting to stop prof"
716.It Dv "P_HADTHREADS" Ta No "0x00000080" Ta "Has had threads (no cleanup shortcuts)"
717.It Dv "P_SUGID" Ta No "0x00000100" Ta "Had set id privileges since last exec"
718.It Dv "P_SYSTEM" Ta No "0x00000200" Ta "System proc: no sigs, stats or swapping"
719.It Dv "P_SINGLE_EXIT" Ta No "0x00000400" Ta "Threads suspending should exit, not wait"
720.It Dv "P_TRACED" Ta No "0x00000800" Ta "Debugged process being traced"
721.It Dv "P_WAITED" Ta No "0x00001000" Ta "Someone is waiting for us"
722.It Dv "P_WEXIT" Ta No "0x00002000" Ta "Working on exiting"
723.It Dv "P_EXEC" Ta No "0x00004000" Ta "Process called exec"
724.It Dv "P_WKILLED" Ta No "0x00008000" Ta "Killed, shall go to kernel/user boundary ASAP"
725.It Dv "P_CONTINUED" Ta No "0x00010000" Ta "Proc has continued from a stopped state"
726.It Dv "P_STOPPED_SIG" Ta No "0x00020000" Ta "Stopped due to SIGSTOP/SIGTSTP"
727.It Dv "P_STOPPED_TRACE" Ta No "0x00040000" Ta "Stopped because of tracing"
728.It Dv "P_STOPPED_SINGLE" Ta No "0x00080000" Ta "Only one thread can continue"
729.It Dv "P_PROTECTED" Ta No "0x00100000" Ta "Do not kill on memory overcommit"
730.It Dv "P_SIGEVENT" Ta No "0x00200000" Ta "Process pending signals changed"
731.It Dv "P_SINGLE_BOUNDARY" Ta No "0x00400000" Ta "Threads should suspend at user boundary"
732.It Dv "P_HWPMC" Ta No "0x00800000" Ta "Process is using HWPMCs"
733.It Dv "P_JAILED" Ta No "0x01000000" Ta "Process is in jail"
734.It Dv "P_TOTAL_STOP" Ta No "0x02000000" Ta "Stopped for system suspend"
735.It Dv "P_INEXEC" Ta No "0x04000000" Ta Process is in Xr execve 2
736.It Dv "P_STATCHILD" Ta No "0x08000000" Ta "Child process stopped or exited"
737.It Dv "P_INMEM" Ta No "0x10000000" Ta "Always set, unused"
738.It Dv "P_PPTRACE" Ta No "0x80000000" Ta "Vforked child issued ptrace(PT_TRACEME)"
739.El
740.It Cm flags2
741The flags kept in
742.Va p_flag2
743associated with the process as in
744the include file
745.In sys/proc.h :
746.Bl -column P2_INHERIT_PROTECTED 0x00000001
747.It Dv "P2_INHERIT_PROTECTED" Ta No "0x00000001" Ta "New children get P_PROTECTED"
748.It Dv "P2_NOTRACE" Ta No "0x00000002" Ta "No" Xr ptrace 2 attach or coredumps
749.It Dv "P2_NOTRACE_EXEC" Ta No "0x00000004" Ta Keep P2_NOPTRACE on Xr execve 2
750.It Dv "P2_AST_SU" Ta No "0x00000008" Ta "Handles SU ast for kthreads"
751.It Dv "P2_PTRACE_FSTP" Ta No "0x00000010" Ta "SIGSTOP from PT_ATTACH not yet handled"
752.It Dv "P2_TRAPCAP" Ta No "0x00000020" Ta "SIGTRAP on ENOTCAPABLE"
753.It Dv "P2_ASLR_ENABLE" Ta No "0x00000040" Ta "Force enable ASLR"
754.It Dv "P2_ASLR_DISABLE" Ta No "0x00000080" Ta "Force disable ASLR"
755.It Dv "P2_ASLR_IGNSTART" Ta No "0x00000100" Ta "Enable ASLR to consume sbrk area"
756.It Dv "P2_PROTMAX_ENABLE" Ta No "0x00000200" Ta "Force enable implied PROT_MAX"
757.It Dv "P2_PROTMAX_DISABLE" Ta No "0x00000400" Ta "Force disable implied PROT_MAX"
758.It Dv "P2_STKGAP_DISABLE" Ta No "0x00000800" Ta "Disable stack gap for MAP_STACK"
759.It Dv "P2_STKGAP_DISABLE_EXEC" Ta No "0x00001000" Ta "Stack gap disabled after exec"
760.It Dv "P2_ITSTOPPED" Ta No "0x00002000" Ta "itimers stopped (as part of process stop)"
761.It Dv "P2_PTRACEREQ" Ta No "0x00004000" Ta "Active ptrace req"
762.It Dv "P2_NO_NEW_PRIVS" Ta No "0x00008000" Ta "Ignore setuid on exec"
763.It Dv "P2_WXORX_DISABLE" Ta No "0x00010000" Ta "WX mappings enabled"
764.It Dv "P2_WXORX_ENABLE_EXEC" Ta No "0x00020000" Ta "WxorX enabled after exec"
765.It Dv "P2_WEXIT" Ta No "0x00040000" Ta "Internal exit early state"
766.It Dv "P2_REAPKILLED" Ta No "0x00080000" Ta "REAP_KILL pass handled the process"
767.It Dv "P2_MEMBAR_PRIVE" Ta No "0x00100000" Ta "membarrier private expedited registered"
768.It Dv "P2_MEMBAR_PRIVE_SYNCORE" Ta No "0x00200000" Ta "membarrier private expedited sync core registered"
769.It Dv "P2_MEMBAR_GLOBE" Ta No "0x00400000" Ta "membar global expedited registered"
770.El
771.It Cm label
772The MAC label of the process.
773.It Cm lim
774The soft limit on memory used, specified via a call to
775.Xr setrlimit 2 .
776.It Cm lstart
777The exact time the command started, using the
778.Ql %c
779format described in
780.Xr strftime 3 .
781.It Cm lockname
782The name of the lock that the process is currently blocked on.
783If the name is invalid or unknown, then
784.Dq ???\&
785is displayed.
786.It Cm logname
787The login name associated with the session the process is in (see
788.Xr getlogin 2 ) .
789.It Cm mwchan
790The event name if the process is blocked normally, or the lock name if
791the process is blocked on a lock.
792See the wchan and lockname keywords
793for details.
794.It Cm nice
795The process scheduling increment (see
796.Xr setpriority 2 ) .
797.It Cm rss
798the real memory (resident set) size of the process in KiB.
799.It Cm start
800The time the command started.
801If the command started less than 24 hours ago, the start time is
802displayed using the
803.Dq Li %H:%M
804format described in
805.Xr strftime 3 .
806If the command started less than 7 days ago, the start time is
807displayed using the
808.Dq Li %a%H
809format.
810Otherwise, the start time is displayed using the
811.Dq Li %e%b%y
812format.
813.It Cm sig
814The bitmask of signals pending in the process queue if the
815.Fl H
816option has not been specified, else the per-thread queue of pending signals.
817.It Cm state
818The state is given by a sequence of characters, for example,
819.Dq Li RWNA .
820The first character indicates the run state of the process:
821.Pp
822.Bl -tag -width indent -compact
823.It Li D
824Marks a process in disk (or other short term, uninterruptible) wait.
825.It Li I
826Marks a process that is idle (sleeping for longer than about 20 seconds).
827.It Li L
828Marks a process that is waiting to acquire a lock.
829.It Li R
830Marks a runnable process.
831.It Li S
832Marks a process that is sleeping for less than about 20 seconds.
833.It Li T
834Marks a stopped process.
835.It Li W
836Marks an idle interrupt thread.
837.It Li Z
838Marks a dead process (a
839.Dq zombie ) .
840.El
841.Pp
842Additional characters after these, if any, indicate additional state
843information:
844.Pp
845.Bl -tag -width indent -compact
846.It Li +
847The process is in the foreground process group of its control terminal.
848.It Li <
849The process has raised CPU scheduling priority.
850.It Li C
851The process is in
852.Xr capsicum 4
853capability mode.
854.It Li E
855The process is trying to exit.
856.It Li J
857Marks a process which is in
858.Xr jail 2 .
859The hostname of the prison can be found in
860.Pa /proc/ Ns Ao Ar pid Ac Ns Pa /status .
861.It Li L
862The process has pages locked in core (for example, for raw I/O).
863.It Li N
864The process has reduced CPU scheduling priority (see
865.Xr setpriority 2 ) .
866.It Li s
867The process is a session leader.
868.It Li V
869The process' parent is suspended during a
870.Xr vfork 2 ,
871waiting for the process to exec or exit.
872.It Li X
873The process is being traced or debugged.
874.El
875.It Cm tt
876An abbreviation for the pathname of the controlling terminal, if any.
877The abbreviation consists of the three letters following
878.Pa /dev/tty ,
879or, for pseudo-terminals, the corresponding entry in
880.Pa /dev/pts .
881This is followed by a
882.Ql -
883if the process can no longer reach that
884controlling terminal (i.e., it has been revoked).
885A
886.Ql -
887without a preceding two letter abbreviation or pseudo-terminal device number
888indicates a process which never had a controlling terminal.
889The full pathname of the controlling terminal is available via the
890.Cm tty
891keyword.
892.It Cm wchan
893The event (an address in the system) on which a process waits.
894When printed numerically, the initial part of the address is
895trimmed off and the result is printed in hex, for example, 0x80324000 prints
896as 324000.
897.El
898.Sh ENVIRONMENT
899The following environment variables affect the execution of
900.Nm :
901.Bl -tag -width ".Ev COLUMNS"
902.It Ev COLUMNS
903If set, specifies the user's preferred output width in column positions.
904Only affects the traditional text style output.
905Please see the preamble of this manual page on how the final output width is
906determined.
907.El
908.Sh FILES
909.Bl -tag -width ".Pa /boot/kernel/kernel" -compact
910.It Pa /boot/kernel/kernel
911default system namelist
912.El
913.Sh EXIT STATUS
914.Ex -std
915.Sh EXAMPLES
916Display information on all system processes:
917.Pp
918.Dl $ ps -auxw
919.Sh SEE ALSO
920.Xr kill 1 ,
921.Xr pgrep 1 ,
922.Xr pkill 1 ,
923.Xr procstat 1 ,
924.Xr w 1 ,
925.Xr kvm 3 ,
926.Xr libxo 3 ,
927.Xr strftime 3 ,
928.Xr xo_options 7 ,
929.Xr mac 4 ,
930.Xr procfs 4 ,
931.Xr pstat 8 ,
932.Xr sysctl 8 ,
933.Xr mutex 9
934.Sh STANDARDS
935For historical reasons, the
936.Nm
937utility under
938.Fx
939supports a different set of options from what is described by
940.St -p1003.1-2024
941and what is supported on
942.No non- Ns Bx
943operating systems.
944.Pp
945In particular, and contrary to this implementation, POSIX specifies that option
946.Fl d
947should serve to select all processes except session leaders, option
948.Fl e
949to select all processes
950.Po
951equivalently to
952.Fl A
953.Pc ,
954and option
955.Fl u
956to select processes by effective user ID.
957.Pp
958However, options
959.Fl A , a , G , l , o , p , U ,
960and
961.Fl t
962behave as prescribed by
963.St -p1003.1-2024 .
964Options
965.Fl f
966and
967.Fl w
968currently do not, but may be changed to in the future.
969.Pp
970POSIX's option
971.Fl g ,
972to select processes having the specified processes as their session leader, is
973not implemented.
974However, other UNIX systems that provide this functionality do so via option
975.Fl s
976instead, reserving
977.Fl g
978to query by group leaders.
979.Sh HISTORY
980The
981.Nm
982command appeared in
983.At v3
984in section 8 of the manual.
985.Sh BUGS
986Since
987.Nm
988cannot run faster than the system and is run as any other scheduled
989process, the information it displays can never be exact.
990.Pp
991.Nm ps
992currently does not correctly limit the ouput width, and in most cases does not
993limit it at all when it should.
994Regardless of the target width, requested columns are always all printed and
995with widths allowing to entirely print their longest values, except for columns
996with keyword
997.Cm command
998or
999.Cm args
1000that are not last in the display
1001.Pq they are truncated to 16 bytes ,
1002and for the last column in the display if its keyword requests textual
1003information of variable length, such as the
1004.Cm command , jail ,
1005and
1006.Cm user
1007keywords do.
1008This considerably limits the effects and usefulness of the terminal width on the
1009output, and consequently that of the
1010.Ev COLUMNS
1011environment variable and the
1012.Fl w
1013option
1014.Pq if specified only once .
1015.Pp
1016The
1017.Nm
1018utility does not correctly display argument lists containing multibyte
1019characters.
1020