PS(1)

๐Ÿ“ฆ version 3.3.17, in centos-stream 9, ubuntu jammy

๐Ÿ‘‘ PS(1) โ€” User Commands ๐Ÿ‘‘

okay so bestie, welcome to ps from section 1 (User Commands), and honestly? she's the main character of every terminal ever. let's get into it ๐Ÿ’…


๐Ÿ’ซ NAME ๐Ÿ’ซ

ps โ€” report a snapshot of the current processes.


๐ŸŒธ SYNOPSIS ๐ŸŒธ

ps [options]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

ps shows you info about a selection of the active processes, periodt. and if what you actually want is a live, repeatedly-updating view of that selection and all its info? then you want top instead, bestie. different girl, different vibe.

this version of ps accepts three whole flavors of options:

  1. UNIX options โ€” these can be grouped together, and they must be preceded by a dash.
  2. BSD options โ€” these can be grouped together too, but they must not be used with a dash.
  3. GNU long options โ€” these get preceded by two dashes.

you can literally mix options of different types freely, no cap, but conflicts can absolutely pop up. and because this ps is compatible with sooo many standards and other ps implementations, some options are straight-up synonymous โ€” functionally identical, just different names. iconic behavior tbh.

๐Ÿšจ okay important, listen up: ps -aux is NOT the same as ps aux. the POSIX and UNIX standards require that ps -aux print all processes owned by a user named x, plus all the processes that would get selected by the -a option. and if a user named x doesn't exist? this ps may just interpret the command as ps aux instead and print a warning. this behavior exists to help transition old scripts and old habits. it is fragile, subject to change, and therefore should not be relied upon. do not build your whole personality on it. ๐Ÿ™ˆ

by default, ps selects all processes with the same effective user ID (euid=EUID) as the current user, associated with the same terminal as whoever invoked it. and then it displays:

  • the process ID (pid=PID)
  • the terminal associated with the process (tname=TTY)
  • the cumulated CPU time in [DD-]hh:mm:ss format (time=TIME)
  • the executable name (ucmd=CMD)

and the output is unsorted by default. it's giving chaos, lowkey. ๐Ÿฆ‹

now, the use of BSD-style options will add process state (stat=STAT) to that default display, and it'll show the command args (args=COMMAND) instead of the executable name. you can override this with the PS_FORMAT environment variable, bestie, you have options. โœจ

the use of BSD-style options will also change the process selection to include processes on other terminals (TTYs) that are owned by you. alternately, you can describe this as setting the selection to be the set of all processes filtered to exclude processes owned by other users or not on a terminal. and here's the tea: these effects are not considered when options are described as being "identical" below โ€” so -M will be considered identical to Z, and so on. iykyk.

except as described below, process selection options are additive. the default selection gets discarded, and then the selected processes get added to the set of processes to be displayed. so a process will be shown if it meets any of the given selection criteria. she's inclusive like that. ๐Ÿ’œ


๐Ÿ”ฅ EXAMPLES ๐Ÿ”ฅ

to see every process on the system using standard syntax:

ps -e
ps -ef
ps -eF
ps -ely

to see every process on the system using BSD syntax:

ps ax
ps axu

to print a process tree:

ps -ejH
ps axjf

to get info about threads:

ps -eLf
ps axms

to get security info:

ps -eo euser,ruser,suser,fuser,f,comm,label
ps axZ
ps -eM

to see every process running as root (real & effective ID) in user format:

ps -U root -u root u

to see every process with a user-defined format:

ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm
ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm
ps -Ao pid,tt,user,fname,tmout,f,wchan

print only the process IDs of syslogd:

ps -C syslogd -o pid=

print only the name of PID 42:

ps -q 42 -o comm=

โœจ SIMPLE PROCESS SELECTION โœจ

  • a โ€” lifts the BSD-style "only yourself" restriction, which gets imposed upon the set of all processes when some BSD-style (no dash) options are used, or when the ps personality setting is BSD-like. the set of processes selected this way is in addition to the set selected by other means. alternate description: this option makes ps list all processes with a terminal (tty), or list all processes when used together with the x option. ๐ŸŽ€
  • -A โ€” select all processes. identical to -e.
  • -a โ€” select all processes except both session leaders (see getsid(2)) and processes not associated with a terminal.
  • -d โ€” select all processes except session leaders.
  • --deselect โ€” select all processes except those that fulfill the specified conditions (negates the selection). identical to -N.
  • -e โ€” select all processes. identical to -A.
  • g โ€” really all, even session leaders. this flag is obsolete and may be discontinued in a future release. it's normally implied by the a flag, and it's only useful when operating in the sunos4 personality. ๐Ÿ’€
  • -N โ€” select all processes except those that fulfill the specified conditions (negates the selection). identical to --deselect.
  • T โ€” select all processes associated with this terminal. identical to the t option without any argument.
  • r โ€” restrict the selection to only running processes.
  • x โ€” lifts the BSD-style "must have a tty" restriction, which gets imposed upon the set of all processes when some BSD-style (no dash) options are used, or when the ps personality setting is BSD-like. the set of processes selected this way is in addition to the set selected by other means. alternate description: this option makes ps list all processes owned by you (same EUID as ps), or list all processes when used together with the a option. ๐ŸŒˆ

๐ŸŽ€ PROCESS SELECTION BY LIST ๐ŸŽ€

these options accept a single argument in the form of a blank-separated or comma-separated list. and they can be used multiple times. for example:

ps -p "1 2" -p 3,4
  • -123 โ€” identical to --pid 123.
  • 123 โ€” identical to --pid 123.
  • -C cmdlist โ€” select by command name. this selects the processes whose executable name is given in cmdlist.
๐Ÿ“ข NOTE: the command name is not the same as the command line. previous versions of procps and the kernel truncated this command name to 15 characters. this limitation is no longer present in both. if you depended on matching only 15 characters, you may no longer get a match. she grew, bestie. ๐Ÿฆ‹
  • -G grplist โ€” select by real group ID (RGID) or name. this selects the processes whose real group name or ID is in the grplist list. the real group ID identifies the group of the user who created the process, see getgid(2).
  • -g grplist โ€” select by session OR by effective group name. selection by session is specified by many standards, but selection by effective group is the logical behavior that several other operating systems use. this ps will select by session when the list is completely numeric (as sessions are). group ID numbers will work only when some group names are also specified. see the -s and --group options.
  • --Group grplist โ€” select by real group ID (RGID) or name. identical to -G.
  • --group grplist โ€” select by effective group ID (EGID) or name. this selects the processes whose effective group name or ID is in grplist. the effective group ID describes the group whose file access permissions are used by the process (see getegid(2)). the -g option is often an alternative to --group.
  • p pidlist โ€” select by process ID. identical to -p and --pid.
  • -p pidlist โ€” select by PID. this selects the processes whose process ID numbers appear in pidlist. identical to p and --pid.
  • --pid pidlist โ€” select by process ID. identical to -p and p.
  • --ppid pidlist โ€” select by parent process ID. this selects the processes with a parent process ID in pidlist. that is, it selects processes that are children of those listed in pidlist. ๐Ÿซถ
  • q pidlist โ€” select by process ID (quick mode). identical to -q and --quick-pid.
  • -q pidlist โ€” select by PID (quick mode). this selects the processes whose process ID numbers appear in pidlist. with this option ps reads the necessary info only for the pids listed in the pidlist and doesn't apply additional filtering rules. the order of pids is unsorted and preserved. no additional selection options, sorting and forest type listings are allowed in this mode. identical to q and --quick-pid.
  • --quick-pid pidlist โ€” select by process ID (quick mode). identical to -q and q.
  • -s sesslist โ€” select by session ID. this selects the processes with a session ID specified in sesslist.
  • --sid sesslist โ€” select by session ID. identical to -s.
  • t ttylist โ€” select by tty. nearly identical to -t and --tty, but it can also be used with an empty ttylist to indicate the terminal associated with ps. using the T option is considered cleaner than using t with an empty ttylist. ๐ŸŒธ
  • -t ttylist โ€” select by tty. this selects the processes associated with the terminals given in ttylist. terminals (ttys, or screens for text output) can be specified in several forms: /dev/ttyS1, ttyS1, S1. a plain - may be used to select processes not attached to any terminal. ๐Ÿ’…
  • --tty ttylist โ€” select by terminal. identical to -t and t.
  • U userlist โ€” select by effective user ID (EUID) or name. this selects the processes whose effective user name or ID is in userlist. the effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)). identical to -u and --user.
  • -U userlist โ€” select by real user ID (RUID) or name. it selects the processes whose real user name or ID is in the userlist list. the real user ID identifies the user who created the process, see getuid(2).
  • -u userlist โ€” select by effective user ID (EUID) or name. this selects the processes whose effective user name or ID is in userlist.

the effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)). identical to U and --user.

  • --User userlist โ€” select by real user ID (RUID) or name. identical to -U.
  • --user userlist โ€” select by effective user ID (EUID) or name. identical to -u and U. โœจ

โœจ OUTPUT FORMAT CONTROL โœจ

Okay bestie, these options are the ones that decide what info actually shows up in your ps output. Heads up though โ€” the output can differ depending on the personality you're in. Yes, ps has personalities. Iconic behavior tbh. ๐Ÿ’…

  • -c โ€” shows you a different flavor of scheduler info for the -l option.
  • --context โ€” displays the security context format (this one's for SELinux).
  • -f โ€” the full-format listing, the glow-up version. You can stack it with tons of other UNIX-style options to add extra columns, and it also makes the command arguments print out. When you pair it with -L, you get the NLWP (number of threads) and LWP (thread ID) columns added in. Check out the c option, the format keyword args, and the format keyword comm.
  • -F โ€” extra full format. Basically peep the -f option, because -F implies it.
  • --format format โ€” user-defined format. Literally identical to -o and o.
  • j โ€” BSD job control format.
  • -j โ€” jobs format.
  • l โ€” displays the BSD long format.
  • -l โ€” long format. The -y option is often super useful alongside this one.
  • -M โ€” adds a column of security data. Identical to Z (for SELinux).
  • O format โ€” this one is preloaded o (aka overloaded). The BSD O option can act like -O (user-defined output format with some common fields already predefined) or it can be used to specify sort order. The tool uses heuristics to figure out which behavior you want. To make sure you actually get the behavior you're after (sorting or formatting), just specify the option some other way (like with -O or --sort). When it's used as a formatting option, it's identical to -O, with the BSD personality.
  • -O format โ€” like -o, but preloaded with some default columns. Identical to -o pid,format,state,tname,time,command or -o pid,format,tname,time,cmd, see -o below.
  • o format โ€” specify user-defined format. Identical to -o and --format.
  • -o format โ€” user-defined format, the DIY queen ๐Ÿ‘‘. The format is a single argument shaped like a blank-separated or comma-separated list, and it's how you pick out individual output columns. The recognized keywords are described down in the STANDARD FORMAT SPECIFIERS section. You can rename headers however you want (ps -o pid,ruser=RealUser -o comm=Command). If all your column headers are empty (ps -o pid= -o comm=) then the header line just won't be output at all. Column width grows as needed for wide headers, and you can use that to widen up columns like WCHAN (ps -o pid,wchan=WIDE-WCHAN-COLUMN -o comm). Explicit width control is on the menu too (ps opid,wchan:42,cmd). Okay and here's a lil gotcha: the behavior of ps -o pid=X,comm=Y varies with personality โ€” you might get one column named "X,comm=Y" or two columns named "X" and "Y". So when in doubt, just use multiple -o options. Use the PS_FORMAT environment variable to set a default if you want; DefSysV and DefBSD are macros you can use to choose the default UNIX or BSD columns.
  • s โ€” displays signal format.
  • u โ€” displays user-oriented format.
  • v โ€” displays virtual memory format.
  • X โ€” register format.
  • -y โ€” don't show flags; show rss in place of addr. This option can only be used with -l.
  • Z โ€” adds a column of security data. Identical to -M (for SELinux).

๐ŸŒธ OUTPUT MODIFIERS ๐ŸŒธ

These ones tweak the vibe of what you're seeing, no cap.

  • c โ€” shows the true command name. It comes from the name of the executable file, not from the argv value. So command arguments โ€” and any modifications to them โ€” just don't show. This option effectively turns the args format keyword into the comm format keyword; it's useful with the -f format option and with the various BSD-style format options, which all normally display the command arguments. See the -f option, the format keyword args, and the format keyword comm.
  • --cols n โ€” set screen width.
  • --columns n โ€” set screen width.
  • --cumulative โ€” includes some dead child process data (as a sum with the parent).
  • e โ€” show the environment after the command.
  • f โ€” ASCII art process hierarchy (forest). It's giving tree ๐ŸŒณ.
  • --forest โ€” ASCII art process tree.
  • h โ€” no header. (Or, one header per screen in the BSD personality.) Okay so, the h option is problematic. Standard BSD ps uses this option to print a header on each page of output, but older Linux ps uses this option to totally disable the header. This version of ps follows the Linux usage โ€” no header printed โ€” unless the BSD personality has been selected, in which case it prints a header on each page of output. Regardless of which personality you're in, you can use the long options --headers and --no-headers to enable printing headers each page or disable headers entirely.
  • -H โ€” show process hierarchy (forest).
  • --headers โ€” repeat header lines, one per page of output.
  • k spec โ€” specify sorting order. The sorting syntax is [+|-]key[,[+|-]key[,...]]. Pick a multi-letter key from the STANDARD FORMAT SPECIFIERS section. The "+" is optional since the default direction is increasing numerical or lexicographic order. Identical to --sort.

Examples:

ps jaxkuid,-ppid,+pid
ps axk comm o comm,args
ps kstart_time -ef
  • --lines n โ€” set screen height.
  • n โ€” numeric output for WCHAN and USER (including all types of UID and GID).
  • --no-headers โ€” print no header line at all. --no-heading is an alias for this option.
  • O order โ€” sorting order (overloaded). The BSD O option can act like -O (user-defined output format with some common fields predefined) or it can be used to specify sort order. Heuristics are used to determine the behavior of this option. To make sure you get the behavior you want (sorting or formatting), specify the option some other way (like with -O or --sort).

For sorting, the obsolete BSD O option syntax is O[+|-]k1[,[+|-]k2[,...]]. It orders the process listing according to the multilevel sort specified by the sequence of one-letter short keys k1,k2, ... described in the OBSOLETE SORT KEYS section below. The "+" is currently optional โ€” it just re-iterates the default direction on a key โ€” but it may help distinguish an O sort from an O format. The "-" reverses direction only on the key it precedes.

  • --rows n โ€” set screen height.
  • S โ€” sum up some information, like CPU usage, from dead child processes into their parent. This is handy for examining a system where a parent process repeatedly forks off short-lived children to do work.
  • --sort spec โ€” specify sorting order. The sorting syntax is [+|-]key[,[+|-]key[,...]]. Choose a multi-letter key from the STANDARD FORMAT SPECIFIERS section. The "+" is optional since the default direction is increasing numerical or lexicographic order. Identical to k. For example: ps jax --sort=uid,-ppid,+pid
  • w โ€” wide output. Use this option twice for unlimited width.
  • -w โ€” wide output. Use this option twice for unlimited width.
  • --width n โ€” set screen width.

๐Ÿงต THREAD DISPLAY ๐Ÿงต

Threads are the moment, fr fr.

  • H โ€” show threads as if they were processes.
  • -L โ€” show threads, possibly with LWP and NLWP columns.
  • m โ€” show threads after processes.
  • -m โ€” show threads after processes.
  • -T โ€” show threads, possibly with SPID column.

๐Ÿ’– OTHER INFORMATION ๐Ÿ’–

  • --help section โ€” print a help message. The section argument can be one of simple, list, output, threads, misc, or all. The argument can be shortened to one of the underlined letters, like: s|l|o|t|m|a.
  • --info โ€” print debugging info.
  • L โ€” list all format specifiers.
  • V โ€” print the procps-ng version.
  • -V โ€” print the procps-ng version.
  • --version โ€” print the procps-ng version.

๐Ÿซถ NOTES ๐Ÿซถ

Okay so this ps works by reading the virtual files in /proc. And it does not need to be setuid kmem or have any privileges to run. Do not give this ps any special permissions, bestie. ๐Ÿ™…โ€โ™€๏ธ

CPU usage is currently expressed as the percentage of time spent running during the entire lifetime of a process. This is not ideal, and it doesn't conform to the standards that ps otherwise conforms to. CPU usage is unlikely to add up to exactly 100%.

The SIZE and RSS fields don't count some parts of a process โ€” including the page tables, kernel stack, struct thread_info, and struct task_struct. This is usually at least 20 KiB of memory that is always resident. SIZE is the virtual size of the process (code+data+stack).

Processes marked <defunct> are dead processes (so-called "zombies") that stick around because their parent hasn't destroyed them properly. These processes will be destroyed by init(8) if the parent process exits.

If the length of the username is greater than the length of the display column, the username gets truncated. See the -o and -O formatting options to customize length.

Commands options such as ps -aux are not recommended, because it's a confusion of two different standards. According to the POSIX and UNIX standards, the above command asks to display all processes with a TTY (generally the commands users are running) plus all processes owned by a user named x. If that user doesn't exist, then ps will assume you really meant ps aux.

๐Ÿ”ฅ PROCESS FLAGS ๐Ÿ”ฅ

The sum of these values is displayed in the "F" column, which is provided by the flags output specifier:

1    forked but didn't exec
4    used super-user privileges

๐Ÿ‘‘ PROCESS STATE CODES ๐Ÿ‘‘

Here are the different values that the s, stat and state output specifiers (header "STAT" or "S") will display to describe the state of a process:

D    uninterruptible sleep (usually IO)
I    Idle kernel thread
R    running or runnable (on run queue)
S    interruptible sleep (waiting for an event to complete)
T    stopped by job control signal
t    stopped by debugger during the tracing
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    defunct ("zombie") process, terminated but not reaped by
     its parent

For BSD formats and when the stat keyword is used, additional characters may be displayed:

<    high-priority (not nice to other users)
N    low-priority (nice to other users)
L    has pages locked into memory (for real-time and custom IO)
s    is a session leader
l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads
     do)
+    is in the foreground process group

๐Ÿซ  OBSOLETE SORT KEYS ๐Ÿซ 

okay so these keys are what the BSD O option uses โ€” but ONLY when it's being used for sorting, bestie. The GNU --sort option does not use these keys, it uses the specifiers down in the STANDARD FORMAT SPECIFIERS section instead. Keep up ๐Ÿ’…

And a lil heads up: the values used in sorting are the internal values ps uses, not the "cooked" values you see in some of the output format fields. Like, sorting on tty sorts into device number, not according to the terminal name that gets displayed. So if you want to sort the cooked values, just pipe ps output into the sort(1) command. iykyk ๐ŸŒธ
  • c / cmd โ€” simple name of executable
  • C / pcpu โ€” cpu utilization
  • f / flags โ€” flags as in long format F field
  • g / pgrp โ€” process group ID
  • G / tpgid โ€” controlling tty process group ID
  • j / cutime โ€” cumulative user time
  • J / cstime โ€” cumulative system time
  • k / utime โ€” user time
  • m / min_flt โ€” number of minor page faults
  • M / maj_flt โ€” number of major page faults
  • n / cmin_flt โ€” cumulative minor page faults
  • N / cmaj_flt โ€” cumulative major page faults
  • o / session โ€” session ID
  • p / pid โ€” process ID
  • P / ppid โ€” parent process ID
  • r / rss โ€” resident set size
  • R / resident โ€” resident pages
  • s / size โ€” memory size in kilobytes
  • S / share โ€” amount of shared pages
  • t / tty โ€” the device number of the controlling tty
  • T / start_time โ€” time process was started
  • U / uid โ€” user ID number
  • u / user โ€” user name
  • v / vsize โ€” total VM size in KiB
  • y / priority โ€” kernel scheduling priority

๐Ÿ”ฎ AIX FORMAT DESCRIPTORS ๐Ÿ”ฎ

This ps supports AIX format descriptors, which work kinda like the formatting codes of printf(1) and printf(3) โ€” fr fr, same energy. For example, the normal default output can be produced with this:

ps -eo "%p %y %x %c"

The NORMAL codes are described in the next section โœจ

  • %C โ†’ NORMAL pcpu โ†’ HEADER %CPU
  • %G โ†’ NORMAL group โ†’ HEADER GROUP
  • %P โ†’ NORMAL ppid โ†’ HEADER PPID
  • %U โ†’ NORMAL user โ†’ HEADER USER
  • %a โ†’ NORMAL args โ†’ HEADER COMMAND
  • %c โ†’ NORMAL comm โ†’ HEADER COMMAND
  • %g โ†’ NORMAL rgroup โ†’ HEADER RGROUP
  • %n โ†’ NORMAL nice โ†’ HEADER NI
  • %p โ†’ NORMAL pid โ†’ HEADER PID
  • %r โ†’ NORMAL pgid โ†’ HEADER PGID
  • %t โ†’ NORMAL etime โ†’ HEADER ELAPSED
  • %u โ†’ NORMAL ruser โ†’ HEADER RUSER
  • %x โ†’ NORMAL time โ†’ HEADER TIME
  • %y โ†’ NORMAL tty โ†’ HEADER TTY
  • %z โ†’ NORMAL vsz โ†’ HEADER VSZ

๐ŸŒŸ STANDARD FORMAT SPECIFIERS ๐ŸŒŸ

Here are all the different keywords you can use to control the output format (like, with option -o) or to sort the selected processes with the GNU-style --sort option. This is the good stuff ๐Ÿ’–

For example:

ps -eo pid,user,args --sort user

This version of ps tries to recognize most of the keywords used in other implementations of ps. Iconic behaviour honestly ๐Ÿ‘‘

The following user-defined format specifiers may contain spaces: args, cmd, comm, command, fname, ucmd, ucomm, lstart, bsdstart, start.

Some keywords may not be available for sorting. It's giving... limited, but we move ๐Ÿ˜ญ

  • %cpu โ€” header %CPU โ€” cpu utilization of the process in "##.#" format. Currently, it is the CPU time used divided by the time the process has been running (cputime/realtime ratio), expressed as a percentage. It will not add up to 100% unless you are lucky. (alias pcpu).
  • %mem โ€” header %MEM โ€” ratio of the process's resident set size to the physical memory on the machine, expressed as a percentage. (alias pmem).
  • args โ€” header COMMAND โ€” command with all its arguments as a string. Modifications to the arguments may be shown. The output in this column may contain spaces. A process marked <defunct> is partly dead, waiting to be fully destroyed by its parent. Sometimes the process args will be unavailable; when this happens, ps will instead print the executable name in brackets. (alias cmd, command). See also the comm format keyword, the -f option, and the c option.
    • When specified last, this column will extend to the edge of the display. If ps can not determine display width, as when output is redirected (piped) into a file or another command, the output width is undefined (it may be 80, unlimited, determined by the TERM variable, and so on). The COLUMNS environment variable or --cols option may be used to exactly determine the width in this case. The w or -w option may be also be used to adjust width.
  • blocked โ€” header BLOCKED โ€” mask of the blocked signals, see signal(7). According to the width of the field, a 32 or 64-bit mask in hexadecimal format is displayed. (alias sig_block, sigmask).
  • bsdstart โ€” header START โ€” time the command started. If the process was started less than 24 hours ago, the output format is " HH:MM", else it is " Mmm:SS" (where Mmm is the three letters of the month). See also lstart, start, start_time, and stime.
  • bsdtime โ€” header TIME โ€” accumulated cpu time, user + system. The display format is usually "MMM:SS", but can be shifted to the right if the process used more than 999 minutes of cpu time.
  • c โ€” header C โ€” processor utilization. Currently, this is the integer value of the percent usage over the lifetime of the process. (see %cpu).
  • caught โ€” header CAUGHT โ€” mask of the caught signals, see signal(7). According to the width of the field, a 32 or 64 bits mask in hexadecimal format is displayed. (alias sig_catch, sigcatch).
  • cgname โ€” header CGNAME โ€” display name of control groups to which the process belongs.
  • cgroup โ€” header CGROUP โ€” display control groups to which the process belongs.
  • class โ€” header CLS โ€” scheduling class of the process. (alias policy, cls). Field's possible values are:
    • - โ€” not reported
    • TS โ€” SCHED_OTHER
    • FF โ€” SCHED_FIFO
    • RR โ€” SCHED_RR
    • B โ€” SCHED_BATCH
    • ISO โ€” SCHED_ISO
    • IDL โ€” SCHED_IDLE
    • DLN โ€” SCHED_DEADLINE
    • ? โ€” unknown value
  • cls โ€” header CLS โ€” scheduling class of the process. (alias policy, cls). Field's possible values are:
    • - โ€” not reported
    • TS โ€” SCHED_OTHER
    • FF โ€” SCHED_FIFO
    • RR โ€” SCHED_RR
    • B โ€” SCHED_BATCH
    • ISO โ€” SCHED_ISO
    • IDL โ€” SCHED_IDLE
    • DLN โ€” SCHED_DEADLINE
    • ? โ€” unknown value
  • cmd โ€” header CMD โ€” see args. (alias args, command).
  • comm โ€” header COMMAND โ€” command name (only the executable name). Modifications to the command name will not be shown. A process marked <defunct> is partly dead, waiting to be fully destroyed by its parent. The output in this column may contain spaces. (alias ucmd, ucomm). See also the args format keyword, the -f option, and the c option.
    • When specified last, this column will extend to the edge of the display. If ps can not determine display width, as when output is redirected (piped) into a file or another command, the output width is undefined (it may be 80, unlimited, determined by the TERM variable, and so on). The COLUMNS environment variable or --cols option may be used to exactly determine the width in this case. The w or -w option may be also be used to adjust width.
  • command โ€” header COMMAND โ€” See args. (alias args, command).
  • cp โ€” header CP โ€” per-mill (tenths of a percent) CPU usage. (see %cpu).
  • cputime โ€” header TIME โ€” cumulative CPU time, "[DD-]hh:mm:ss" format. (alias time).
  • cputimes โ€” header TIME โ€” cumulative CPU time in seconds (alias times).
  • drs โ€” header DRS โ€” data resident set size, the amount of physical memory devoted to other than executable code.
  • egid โ€” header EGID โ€” effective group ID number of the process as a decimal integer. (alias gid).
  • egroup โ€” header EGROUP โ€” effective group ID of the process. This will be the textual group ID, if it can be obtained and the field width permits, or a decimal representation otherwise. (alias group).
  • eip โ€” header EIP โ€” instruction pointer.
  • esp โ€” header ESP โ€” stack pointer.
  • etime โ€” header ELAPSED โ€” elapsed time since the process was started, in the form [[DD-]hh:]mm:ss.
  • etimes โ€” header ELAPSED โ€” elapsed time since the process was started, in seconds.
  • euid โ€” header EUID โ€” effective user ID (alias uid).
  • euser โ€” header EUSER โ€” effective user name. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. The n option can be used to force the decimal representation. (alias uname, user).
  • exe โ€” header EXE โ€” path to the executable. Useful if path cannot be printed via cmd, comm or args format options.
  • f โ€” header F โ€” flags associated with the process, see the PROCESS FLAGS section. (alias flag, flags).
  • fgid โ€” header FGID โ€” filesystem access group ID. (alias fsgid).

  • fgroup, FGROUP โ€” filesystem access group ID. It'll show the textual group ID if it can be obtained and the field width permits, otherwise it's a decimal representation, periodt. (alias fsgroup). ๐Ÿ’…
  • flag, F โ€” okay so this is just a redirect: see f. (alias f, flags). ๐Ÿ”
  • flags, F โ€” another redirect bestie, see f. (alias f, flag). ๐Ÿ”
  • fname, COMMAND โ€” first 8 bytes of the base name of the process's executable file. Heads up, the output in this column may contain spaces. ๐Ÿ˜ญ
  • fuid, FUID โ€” filesystem access user ID. (alias fsuid). โœจ
  • fuser, FUSER โ€” filesystem access user ID. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. ๐Ÿ’–
  • gid, GID โ€” see egid. (alias egid). ๐Ÿ”
  • group, GROUP โ€” see egroup. (alias egroup). ๐Ÿ”
  • ignored, IGNORED โ€” mask of the ignored signals, see signal(7). According to the width of the field, a 32 or 64 bits mask in hexadecimal format is displayed. (alias sig_ignore, sigignore). ๐Ÿšซ
  • ipcns, IPCNS โ€” Unique inode number describing the namespace the process belongs to. See namespaces(7). ๐ŸŒ€
  • label, LABEL โ€” security label, most commonly used for SELinux context data. This is for the Mandatory Access Control ("MAC") found on high-security systems. ๐Ÿ”’
  • lstart, STARTED โ€” time the command started. See also bsdstart, start, start_time, and stime. โฐ
  • lsession, SESSION โ€” displays the login session identifier of a process, if systemd support has been included. ๐Ÿชช
  • luid, LUID โ€” displays Login ID associated with a process. ๐Ÿ†”
  • lwp, LWP โ€” light weight process (thread) ID of the dispatchable entity (alias spid, tid). See tid for additional information. ๐Ÿงต
  • lxc, LXC โ€” The name of the lxc container within which a task is running. If a process is not running inside a container, a dash (-) will be shown. ๐Ÿ“ฆ
  • machine, MACHINE โ€” displays the machine name for processes assigned to VM or container, if systemd support has been included. ๐Ÿ–ฅ๏ธ
  • maj_flt, MAJFLT โ€” The number of major page faults that have occurred with this process. ๐Ÿ’ฅ
  • min_flt, MINFLT โ€” The number of minor page faults that have occurred with this process. โœจ
  • mntns, MNTNS โ€” Unique inode number describing the namespace the process belongs to. See namespaces(7). ๐Ÿ—‚๏ธ
  • netns, NETNS โ€” Unique inode number describing the namespace the process belongs to. See namespaces(7). ๐ŸŒ
  • ni, NI โ€” nice value. This ranges from 19 (nicest) to -20 (not nice to others), see nice(1). (alias nice). ๐Ÿ˜‡
  • nice, NI โ€” see ni. (alias ni). ๐Ÿ”
  • nlwp, NLWP โ€” number of lwps (threads) in the process. (alias thcount). ๐Ÿงฎ
  • numa, NUMA โ€” The node associated with the most recently used processor. A -1 means that NUMA information is unavailable. ๐Ÿง 
  • nwchan, WCHAN โ€” address of the kernel function where the process is sleeping (use wchan if you want the kernel function name). Running tasks will display a dash (-) in this column. ๐Ÿ˜ด
  • ouid, OWNER โ€” displays the Unix user identifier of the owner of the session of a process, if systemd support has been included. ๐Ÿ‘‘
  • pcpu, %CPU โ€” see %cpu. (alias %cpu). ๐Ÿ”
  • pending, PENDING โ€” mask of the pending signals. See signal(7). Signals pending on the process are distinct from signals pending on individual threads. Use the m option or the -m option to see both. According to the width of the field, a 32 or 64 bits mask in hexadecimal format is displayed. (alias sig). โณ
  • pgid, PGID โ€” process group ID or, equivalently, the process ID of the process group leader. (alias pgrp). ๐Ÿ‘ฏ
  • pgrp, PGRP โ€” see pgid. (alias pgid). ๐Ÿ”
  • pid, PID โ€” a number representing the process ID (alias tgid). ๐Ÿ”ข
  • pidns, PIDNS โ€” Unique inode number describing the namespace the process belongs to. See namespaces(7). ๐ŸŒ€
  • pmem, %MEM โ€” see %mem. (alias %mem). ๐Ÿ”
  • policy, POL โ€” scheduling class of the process. (alias class, cls). Possible values are:
    • - โ€” not reported
    • TS โ€” SCHED_OTHER
    • FF โ€” SCHED_FIFO
    • RR โ€” SCHED_RR
    • B โ€” SCHED_BATCH
    • ISO โ€” SCHED_ISO
    • IDL โ€” SCHED_IDLE
    • DLN โ€” SCHED_DEADLINE
    • ? โ€” unknown value
  • ppid, PPID โ€” parent process ID. ๐Ÿ‘จโ€๐Ÿ‘ง
  • pri, PRI โ€” priority of the process. Higher number means lower priority. โฌ†๏ธโฌ‡๏ธ
  • psr, PSR โ€” processor that process is currently assigned to. ๐Ÿ–ฅ๏ธ
  • rgid, RGID โ€” real group ID. ๐Ÿ†”
  • rgroup, RGROUP โ€” real group name. This will be the textual group ID, if it can be obtained and the field width permits, or a decimal representation otherwise. ๐Ÿ’–
  • rss, RSS โ€” resident set size, the non-swapped physical memory that a task has used (in kilobytes). (alias rssize, rsz). ๐Ÿง 
  • rssize, RSS โ€” see rss. (alias rss, rsz). ๐Ÿ”
  • rsz, RSZ โ€” see rss. (alias rss, rssize). ๐Ÿ”
  • rtprio, RTPRIO โ€” realtime priority. โšก
  • ruid, RUID โ€” real user ID. ๐Ÿ†”
  • ruser, RUSER โ€” real user ID. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. ๐Ÿ’–
  • s, S โ€” minimal state display (one character). See section PROCESS STATE CODES for the different values. See also stat if you want additional information displayed. (alias state). ๐Ÿ”ค
  • sched, SCH โ€” scheduling policy of the process. The policies SCHED_OTHER (SCHED_NORMAL), SCHED_FIFO, SCHED_RR, SCHED_BATCH, SCHED_ISO, SCHED_IDLE and SCHED_DEADLINE are respectively displayed as 0, 1, 2, 3, 4, 5 and 6. ๐Ÿ“…
  • seat, SEAT โ€” displays the identifier associated with all hardware devices assigned to a specific workplace, if systemd support has been included. ๐Ÿช‘
  • sess, SESS โ€” session ID or, equivalently, the process ID of the session leader. (alias session, sid). ๐Ÿชช
  • sgi_p, P โ€” processor that the process is currently executing on. Displays "*" if the process is not currently running or runnable. โญ
  • sgid, SGID โ€” saved group ID. (alias svgid). ๐Ÿ†”
  • sgroup, SGROUP โ€” saved group name. This will be the textual group ID, if it can be obtained and the field width permits, or a decimal representation otherwise. ๐Ÿ’–
  • sid, SID โ€” see sess. (alias sess, session). ๐Ÿ”
  • sig, PENDING โ€” see pending. (alias pending, sig_pend). ๐Ÿ”
  • sigcatch, CAUGHT โ€” see caught. (alias caught, sig_catch). ๐Ÿ”
  • sigignore, IGNORED โ€” see ignored. (alias ignored, sig_ignore). ๐Ÿ”
  • sigmask, BLOCKED โ€” see blocked. (alias blocked, sig_block). ๐Ÿ”
  • size, SIZE โ€” approximate amount of swap space that would be required if the process were to dirty all writable pages and then be swapped out. This number is very rough! ๐Ÿ˜ฌ
  • slice, SLICE โ€” displays the slice unit which a process belongs to, if systemd support has been included. ๐Ÿฐ
  • spid, SPID โ€” see lwp. (alias lwp, tid). ๐Ÿ”
  • stackp, STACKP โ€” address of the bottom (start) of stack for the process. ๐Ÿฅž
  • start, STARTED โ€” time the command started. If the process was started less than 24 hours ago, the output format is "HH:MM:SS", else it is " Mmm dd" (where Mmm is a three-letter month name). See also lstart, bsdstart, start_time, and stime. โฐ
  • start_time, START โ€” starting time or date of the process. Only the year will be displayed if the process was not started the same year ps was invoked, or "MmmDD" if it was not started the same day, or "HH:MM" otherwise. See also bsdstart, start, lstart, and stime. ๐Ÿ“…
  • stat, STAT โ€” multi-character process state. See section PROCESS STATE CODES for the different values meaning. See also s and state if you just want the first character displayed. ๐Ÿ”ค
  • state, S โ€” see s. (alias s). ๐Ÿ”
  • stime, STIME โ€” see start_time. (alias start_time). ๐Ÿ”
  • suid, SUID โ€” saved user ID. (alias svuid). ๐Ÿ†”
  • supgid, SUPGID โ€” group ids of supplementary groups, if any. See getgroups(2). ๐Ÿ‘ฅ
  • supgrp, SUPGRP โ€” group names of supplementary groups, if any. See getgroups(2). ๐Ÿ‘ฅ
  • suser, SUSER โ€” saved user name. This will be the textual user ID, if it can be obtained and the field width permits, or a decimal representation otherwise. (alias svuser). ๐Ÿ’–
  • svgid, SVGID โ€” see sgid. (alias sgid). ๐Ÿ”
  • svuid, SVUID โ€” see suid. (alias suid). ๐Ÿ”
  • sz, SZ โ€” size in physical pages of the core image of the process. This includes text, data, and stack space. Device mappings are currently excluded; this is subject to change. See vsz and rss. ๐Ÿง 
  • tgid, TGID โ€” a number representing the thread group to which a task belongs (alias pid). It is the process ID of the thread group leader. ๐Ÿงต
  • thcount, THCNT โ€” bestie, this one says see nlwp. (alias nlwp). It's the number of kernel threads owned by the process. periodt โœจ
  • tid, TID โ€” the unique number representing a dispatchable entity (alias lwp, spid). This value may also appear as: a process ID (pid); a process group ID (pgrp); a session ID for the session leader (sid); a thread group ID for the thread group leader (tgid); and a tty process group ID for the process group leader (tpgid). it's giving every ID at once ๐Ÿ’…
  • time, TIME โ€” cumulative CPU time, "[DD-]HH:MM:SS" format. (alias cputime). โฐ
  • times, TIME โ€” cumulative CPU time in seconds (alias cputimes). โณ
  • tname, TTY โ€” controlling tty (terminal). (alias tt, tty). ๐Ÿ–ฅ๏ธ
  • tpgid, TPGID โ€” ID of the foreground process group on the tty (terminal) that the process is connected to, or -1 if the process is not connected to a tty. no tty? it's -1, bestie ๐Ÿซถ
  • trs, TRS โ€” text resident set size, the amount of physical memory devoted to executable code. ๐Ÿง 
  • tt, TT โ€” controlling tty (terminal). (alias tname, tty). โœจ
  • tty, TT โ€” controlling tty (terminal). (alias tname, tt). ๐ŸŒธ
  • ucmd, CMD โ€” see comm. (alias comm, ucomm). ๐Ÿ’–
  • ucomm, COMMAND โ€” see comm. (alias comm, ucmd). ๐Ÿ’ซ
  • uid, UID โ€” see euid. (alias euid). ๐Ÿ†”
  • uname, USER โ€” see euser. (alias euser, user). ๐Ÿ‘‘
  • unit, UNIT โ€” displays unit which a process belongs to, if systemd support has been included. ๐Ÿงš
  • user, USER โ€” see euser. (alias euser, uname). ๐Ÿซถ
  • userns, USERNS โ€” Unique inode number describing the namespace the process belongs to. See namespaces(7). ๐ŸŒˆ
  • utsns, UTSNS โ€” Unique inode number describing the namespace the process belongs to. See namespaces(7). ๐Ÿฆ‹
  • uunit, UUNIT โ€” displays user unit which a process belongs to, if systemd support has been included. ๐ŸŒŸ
  • vsize, VSZ โ€” see vsz. (alias vsz). ๐Ÿ’…
  • vsz, VSZ โ€” virtual memory size of the process in KiB (1024-byte units). Device mappings are currently excluded; this is subject to change. (alias vsize). subject to change, so don't make it your whole personality ๐Ÿ˜ญ
  • wchan, WCHAN โ€” name of the kernel function in which the process is sleeping, a "-" if the process is running, or a "*" if the process is multi-threaded and ps is not displaying threads. ๐Ÿ’ค

๐ŸŒฟ ENVIRONMENT VARIABLES ๐ŸŒฟ

The following environment variables could affect ps:

  • COLUMNS โ€” Override default display width. ๐Ÿ“
  • LINES โ€” Override default display height. ๐Ÿ“
  • PS_PERSONALITY โ€” Set to one of posix, old, linux, bsd, sun, digital... (see section PERSONALITY below). ๐ŸŽญ
  • CMD_ENV โ€” Set to one of posix, old, linux, bsd, sun, digital... (see section PERSONALITY below). ๐ŸŽญ
  • I_WANT_A_BROKEN_PS โ€” Force obsolete command line interpretation. ๐Ÿ’€
  • LC_TIME โ€” Date format. ๐Ÿ“…
  • PS_COLORS โ€” Not currently supported. ๐Ÿ™ˆ
  • PS_FORMAT โ€” Default output format override. You may set this to a format string of the type used for the -o option. The DefSysV and DefBSD values are particularly useful. โœจ
  • POSIXLY_CORRECT โ€” Don't find excuses to ignore bad "features". ๐Ÿ˜Œ
  • POSIX2 โ€” When set to "on", acts as POSIXLY_CORRECT. ๐Ÿ”›
  • UNIX95 โ€” Don't find excuses to ignore bad "features". ๐Ÿ˜Œ
  • _XPG โ€” Cancel CMD_ENV=irix non-standard behavior. ๐Ÿšซ
okay so in general, it is a bad idea to set these variables. The one exception is CMD_ENV or PS_PERSONALITY, which could be set to Linux for normal systems. Without that setting, ps follows the useless and bad parts of the Unix98 standard. iykyk ๐Ÿ’…

๐ŸŽญ PERSONALITY ๐ŸŽญ

  • 390 โ€” like the OS/390 OpenEdition ps
  • aix โ€” like AIX ps
  • bsd โ€” like FreeBSD ps (totally non-standard)
  • compaq โ€” like Digital Unix ps
  • debian โ€” like the old Debian ps
  • digital โ€” like Tru64 (was Digital Unix, was OSF/1) ps
  • gnu โ€” like the old Debian ps
  • hp โ€” like HP-UX ps
  • hpux โ€” like HP-UX ps
  • irix โ€” like Irix ps
  • linux โ€” * recommended *
  • old โ€” like the original Linux ps (totally non-standard)
  • os390 โ€” like OS/390 Open Edition ps
  • posix โ€” standard
  • s390 โ€” like OS/390 Open Edition ps
  • sco โ€” like SCO ps
  • sgi โ€” like Irix ps
  • solaris2 โ€” like Solaris 2+ (SunOS 5) ps
  • sunos4 โ€” like SunOS 4 (Solaris 1) ps (totally non-standard)
  • svr4 โ€” standard
  • sysv โ€” standard
  • tru64 โ€” like Tru64 (was Digital Unix, was OSF/1) ps
  • unix โ€” standard
  • unix95 โ€” standard
  • unix98 โ€” standard

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

bestie, go peek at pgrep(1), pstree(1), top(1), and proc(5). ๐Ÿ’–


๐Ÿ“œ STANDARDS ๐Ÿ“œ

This ps conforms to:

  1. Version 2 of the Single Unix Specification
  2. The Open Group Technical Standard Base Specifications, Issue 6
  3. IEEE Std 1003.1, 2004 Edition
  4. X/Open System Interfaces Extension [UP XSI]
  5. ISO/IEC 9945:2003

๐Ÿ‘‘ AUTHOR ๐Ÿ‘‘

okay so ps was originally written by Branko Lankester. Michael K. Johnson re-wrote it significantly to use the proc filesystem, changing a few things in the process. Michael Shields added the pid-list feature. Charles Blake added multi-level sorting, the dirent-style library, the device name-to-number mmaped database, the approximate binary search directly on System.map, and many code and documentation cleanups. David Mossberger-Tang wrote the generic BFD support for psupdate. Albert Cahalan rewrote ps for full Unix98 and BSD support, along with some ugly hacks for obsolete and foreign syntax.

Please send bug reports to procps@freelists.org. No subscription is required or suggested. slay, they said what they said ๐Ÿ’…


this whole page is from procps-ng, dated 2020-06-04, and it's PS(1) โ€” bye bestie, go check your processes ๐Ÿ’–โœจ

๐Ÿ“ฆ where this page comes from