PS(1)
๐ 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:
- UNIX options โ these can be grouped together, and they must be preceded by a dash.
- BSD options โ these can be grouped together too, but they must not be used with a dash.
- 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 -auxis NOT the same asps aux. the POSIX and UNIX standards require thatps -auxprint all processes owned by a user namedx, plus all the processes that would get selected by the-aoption. and if a user namedxdoesn't exist? thispsmay just interpret the command asps auxinstead 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:ssformat (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 thepspersonality 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 makespslist all processes with a terminal (tty), or list all processes when used together with thexoption. ๐-Aโ select all processes. identical to-e.-aโ select all processes except both session leaders (seegetsid(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 theaflag, and it's only useful when operating in thesunos4personality. ๐-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 thetoption 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 thepspersonality 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 makespslist all processes owned by you (same EUID asps), or list all processes when used together with theaoption. ๐
๐ 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.-Ccmdlist โ 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. ๐ฆ
-Ggrplist โ 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, seegetgid(2).-ggrplist โ 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. thispswill 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-sand--groupoptions.--Groupgrplist โ select by real group ID (RGID) or name. identical to-G.--groupgrplist โ 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 (seegetegid(2)). the-goption is often an alternative to--group.ppidlist โ select by process ID. identical to-pand--pid.-ppidlist โ select by PID. this selects the processes whose process ID numbers appear in pidlist. identical topand--pid.--pidpidlist โ select by process ID. identical to-pandp.--ppidpidlist โ 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. ๐ซถqpidlist โ select by process ID (quick mode). identical to-qand--quick-pid.-qpidlist โ select by PID (quick mode). this selects the processes whose process ID numbers appear in pidlist. with this optionpsreads 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 toqand--quick-pid.--quick-pidpidlist โ select by process ID (quick mode). identical to-qandq.-ssesslist โ select by session ID. this selects the processes with a session ID specified in sesslist.--sidsesslist โ select by session ID. identical to-s.tttylist โ select by tty. nearly identical to-tand--tty, but it can also be used with an empty ttylist to indicate the terminal associated withps. using theToption is considered cleaner than usingtwith an empty ttylist. ๐ธ-tttylist โ 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. ๐--ttyttylist โ select by terminal. identical to-tandt.Uuserlist โ 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 (seegeteuid(2)). identical to-uand--user.-Uuserlist โ 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, seegetuid(2).-uuserlist โ 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.
--Useruserlist โ select by real user ID (RUID) or name. identical to-U.--useruserlist โ select by effective user ID (EUID) or name. identical to-uandU. โจ
โจ 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-loption.--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 theNLWP(number of threads) andLWP(thread ID) columns added in. Check out thecoption, the format keywordargs, and the format keywordcomm.-Fโ extra full format. Basically peep the-foption, because-Fimplies it.--formatformat โ user-defined format. Literally identical to-oando.jโ BSD job control format.-jโ jobs format.lโ displays the BSD long format.-lโ long format. The-yoption is often super useful alongside this one.-Mโ adds a column of security data. Identical toZ(for SELinux).Oformat โ this one is preloadedo(aka overloaded). The BSDOoption 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-Oor--sort). When it's used as a formatting option, it's identical to-O, with the BSD personality.-Oformat โ like-o, but preloaded with some default columns. Identical to-o pid,format,state,tname,time,commandor-o pid,format,tname,time,cmd, see-obelow.oformat โ specify user-defined format. Identical to-oand--format.-oformat โ 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 likeWCHAN(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 ofps -o pid=X,comm=Yvaries 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-ooptions. Use thePS_FORMATenvironment variable to set a default if you want;DefSysVandDefBSDare 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; showrssin place ofaddr. 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 theargvvalue. So command arguments โ and any modifications to them โ just don't show. This option effectively turns theargsformat keyword into thecommformat keyword; it's useful with the-fformat option and with the various BSD-style format options, which all normally display the command arguments. See the-foption, the format keywordargs, and the format keywordcomm.--colsn โ set screen width.--columnsn โ 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, thehoption is problematic. Standard BSDpsuses this option to print a header on each page of output, but older Linuxpsuses this option to totally disable the header. This version ofpsfollows 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--headersand--no-headersto enable printing headers each page or disable headers entirely.-Hโ show process hierarchy (forest).--headersโ repeat header lines, one per page of output.kspec โ 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
--linesn โ set screen height.nโ numeric output forWCHANandUSER(including all types of UID and GID).--no-headersโ print no header line at all.--no-headingis an alias for this option.Oorder โ sorting order (overloaded). The BSDOoption 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-Oor--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.
--rowsn โ 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.--sortspec โ 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 tok. For example:ps jax --sort=uid,-ppid,+pidwโ wide output. Use this option twice for unlimited width.-wโ wide output. Use this option twice for unlimited width.--widthn โ set screen width.
๐งต THREAD DISPLAY ๐งต
Threads are the moment, fr fr.
Hโ show threads as if they were processes.-Lโ show threads, possibly withLWPandNLWPcolumns.mโ show threads after processes.-mโ show threads after processes.-Tโ show threads, possibly withSPIDcolumn.
๐ OTHER INFORMATION ๐
--helpsection โ print a help message. The section argument can be one ofsimple,list,output,threads,misc, orall. 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 asps -auxare 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 namedx. If that user doesn't exist, thenpswill assume you really meantps 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 valuespsuses, not the "cooked" values you see in some of the output format fields. Like, sorting onttysorts into device number, not according to the terminal name that gets displayed. So if you want to sort the cooked values, just pipepsoutput into thesort(1)command. iykyk ๐ธ
c/cmdโ simple name of executableC/pcpuโ cpu utilizationf/flagsโ flags as in long formatFfieldg/pgrpโ process group IDG/tpgidโ controlling tty process group IDj/cutimeโ cumulative user timeJ/cstimeโ cumulative system timek/utimeโ user timem/min_fltโ number of minor page faultsM/maj_fltโ number of major page faultsn/cmin_fltโ cumulative minor page faultsN/cmaj_fltโ cumulative major page faultso/sessionโ session IDp/pidโ process IDP/ppidโ parent process IDr/rssโ resident set sizeR/residentโ resident pagess/sizeโ memory size in kilobytesS/shareโ amount of shared pagest/ttyโ the device number of the controlling ttyT/start_timeโ time process was startedU/uidโ user ID numberu/userโ user namev/vsizeโ total VM size in KiBy/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โ NORMALpcpuโ HEADER%CPU%Gโ NORMALgroupโ HEADERGROUP%Pโ NORMALppidโ HEADERPPID%Uโ NORMALuserโ HEADERUSER%aโ NORMALargsโ HEADERCOMMAND%cโ NORMALcommโ HEADERCOMMAND%gโ NORMALrgroupโ HEADERRGROUP%nโ NORMALniceโ HEADERNI%pโ NORMALpidโ HEADERPID%rโ NORMALpgidโ HEADERPGID%tโ NORMALetimeโ HEADERELAPSED%uโ NORMALruserโ HEADERRUSER%xโ NORMALtimeโ HEADERTIME%yโ NORMALttyโ HEADERTTY%zโ NORMALvszโ HEADERVSZ
๐ 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. (aliaspcpu).%memโ header%MEMโ ratio of the process's resident set size to the physical memory on the machine, expressed as a percentage. (aliaspmem).argsโ headerCOMMANDโ 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,pswill instead print the executable name in brackets. (aliascmd,command). See also thecommformat keyword, the-foption, and thecoption.- When specified last, this column will extend to the edge of the display. If
pscan 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 theTERMvariable, and so on). TheCOLUMNSenvironment variable or--colsoption may be used to exactly determine the width in this case. Thewor-woption may be also be used to adjust width.
- When specified last, this column will extend to the edge of the display. If
blockedโ headerBLOCKEDโ mask of the blocked signals, seesignal(7). According to the width of the field, a 32 or 64-bit mask in hexadecimal format is displayed. (aliassig_block,sigmask).bsdstartโ headerSTARTโ 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"(whereMmmis the three letters of the month). See alsolstart,start,start_time, andstime.bsdtimeโ headerTIMEโ 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โ headerCโ processor utilization. Currently, this is the integer value of the percent usage over the lifetime of the process. (see%cpu).caughtโ headerCAUGHTโ mask of the caught signals, seesignal(7). According to the width of the field, a 32 or 64 bits mask in hexadecimal format is displayed. (aliassig_catch,sigcatch).cgnameโ headerCGNAMEโ display name of control groups to which the process belongs.cgroupโ headerCGROUPโ display control groups to which the process belongs.classโ headerCLSโ scheduling class of the process. (aliaspolicy,cls). Field's possible values are:-โ not reportedTSโSCHED_OTHERFFโSCHED_FIFORRโSCHED_RRBโSCHED_BATCHISOโSCHED_ISOIDLโSCHED_IDLEDLNโSCHED_DEADLINE?โ unknown value
clsโ headerCLSโ scheduling class of the process. (aliaspolicy,cls). Field's possible values are:-โ not reportedTSโSCHED_OTHERFFโSCHED_FIFORRโSCHED_RRBโSCHED_BATCHISOโSCHED_ISOIDLโSCHED_IDLEDLNโSCHED_DEADLINE?โ unknown value
cmdโ headerCMDโ seeargs. (aliasargs,command).commโ headerCOMMANDโ 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. (aliasucmd,ucomm). See also theargsformat keyword, the-foption, and thecoption.- When specified last, this column will extend to the edge of the display. If
pscan 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 theTERMvariable, and so on). TheCOLUMNSenvironment variable or--colsoption may be used to exactly determine the width in this case. Thewor-woption may be also be used to adjust width.
- When specified last, this column will extend to the edge of the display. If
commandโ headerCOMMANDโ Seeargs. (aliasargs,command).cpโ headerCPโ per-mill (tenths of a percent) CPU usage. (see%cpu).cputimeโ headerTIMEโ cumulative CPU time,"[DD-]hh:mm:ss"format. (aliastime).cputimesโ headerTIMEโ cumulative CPU time in seconds (aliastimes).drsโ headerDRSโ data resident set size, the amount of physical memory devoted to other than executable code.egidโ headerEGIDโ effective group ID number of the process as a decimal integer. (aliasgid).egroupโ headerEGROUPโ 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. (aliasgroup).eipโ headerEIPโ instruction pointer.espโ headerESPโ stack pointer.etimeโ headerELAPSEDโ elapsed time since the process was started, in the form[[DD-]hh:]mm:ss.etimesโ headerELAPSEDโ elapsed time since the process was started, in seconds.euidโ headerEUIDโ effective user ID (aliasuid).euserโ headerEUSERโ 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. Thenoption can be used to force the decimal representation. (aliasuname,user).exeโ headerEXEโ path to the executable. Useful if path cannot be printed viacmd,commorargsformat options.fโ headerFโ flags associated with the process, see the PROCESS FLAGS section. (aliasflag,flags).fgidโ headerFGIDโ filesystem access group ID. (aliasfsgid).
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. (aliasfsgroup). ๐flag,Fโ okay so this is just a redirect: seef. (aliasf,flags). ๐flags,Fโ another redirect bestie, seef. (aliasf,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. (aliasfsuid). โจ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โ seeegid. (aliasegid). ๐group,GROUPโ seeegroup. (aliasegroup). ๐ignored,IGNOREDโ mask of the ignored signals, seesignal(7). According to the width of the field, a 32 or 64 bits mask in hexadecimal format is displayed. (aliassig_ignore,sigignore). ๐ซipcns,IPCNSโ Unique inode number describing the namespace the process belongs to. Seenamespaces(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 alsobsdstart,start,start_time, andstime. โฐ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 (aliasspid,tid). Seetidfor 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. Seenamespaces(7). ๐๏ธnetns,NETNSโ Unique inode number describing the namespace the process belongs to. Seenamespaces(7). ๐ni,NIโ nice value. This ranges from19(nicest) to-20(not nice to others), seenice(1). (aliasnice). ๐nice,NIโ seeni. (aliasni). ๐nlwp,NLWPโ number of lwps (threads) in the process. (aliasthcount). ๐งฎnuma,NUMAโ The node associated with the most recently used processor. A-1means that NUMA information is unavailable. ๐งnwchan,WCHANโ address of the kernel function where the process is sleeping (usewchanif 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. Seesignal(7). Signals pending on the process are distinct from signals pending on individual threads. Use themoption or the-moption to see both. According to the width of the field, a 32 or 64 bits mask in hexadecimal format is displayed. (aliassig). โณpgid,PGIDโ process group ID or, equivalently, the process ID of the process group leader. (aliaspgrp). ๐ฏpgrp,PGRPโ seepgid. (aliaspgid). ๐pid,PIDโ a number representing the process ID (aliastgid). ๐ขpidns,PIDNSโ Unique inode number describing the namespace the process belongs to. Seenamespaces(7). ๐pmem,%MEMโ see%mem. (alias%mem). ๐policy,POLโ scheduling class of the process. (aliasclass,cls). Possible values are:-โ not reportedTSโSCHED_OTHERFFโSCHED_FIFORRโSCHED_RRBโSCHED_BATCHISOโSCHED_ISOIDLโSCHED_IDLEDLNโ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). (aliasrssize,rsz). ๐งrssize,RSSโ seerss. (aliasrss,rsz). ๐rsz,RSZโ seerss. (aliasrss,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 alsostatif you want additional information displayed. (aliasstate). ๐คsched,SCHโ scheduling policy of the process. The policiesSCHED_OTHER(SCHED_NORMAL),SCHED_FIFO,SCHED_RR,SCHED_BATCH,SCHED_ISO,SCHED_IDLEandSCHED_DEADLINEare respectively displayed as0,1,2,3,4,5and6. ๐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. (aliassession,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. (aliassvgid). ๐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โ seesess. (aliassess,session). ๐sig,PENDINGโ seepending. (aliaspending,sig_pend). ๐sigcatch,CAUGHTโ seecaught. (aliascaught,sig_catch). ๐sigignore,IGNOREDโ seeignored. (aliasignored,sig_ignore). ๐sigmask,BLOCKEDโ seeblocked. (aliasblocked,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โ seelwp. (aliaslwp,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"(whereMmmis a three-letter month name). See alsolstart,bsdstart,start_time, andstime. โฐstart_time,STARTโ starting time or date of the process. Only the year will be displayed if the process was not started the same yearpswas invoked, or"MmmDD"if it was not started the same day, or"HH:MM"otherwise. See alsobsdstart,start,lstart, andstime. ๐stat,STATโ multi-character process state. See section PROCESS STATE CODES for the different values meaning. See alsosandstateif you just want the first character displayed. ๐คstate,Sโ sees. (aliass). ๐stime,STIMEโ seestart_time. (aliasstart_time). ๐suid,SUIDโ saved user ID. (aliassvuid). ๐supgid,SUPGIDโ group ids of supplementary groups, if any. Seegetgroups(2). ๐ฅsupgrp,SUPGRPโ group names of supplementary groups, if any. Seegetgroups(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. (aliassvuser). ๐svgid,SVGIDโ seesgid. (aliassgid). ๐svuid,SVUIDโ seesuid. (aliassuid). ๐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. Seevszandrss. ๐งtgid,TGIDโ a number representing the thread group to which a task belongs (aliaspid). It is the process ID of the thread group leader. ๐งตthcount,THCNTโ bestie, this one says seenlwp. (aliasnlwp). It's the number of kernel threads owned by the process. periodt โจtid,TIDโ the unique number representing a dispatchable entity (aliaslwp,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. (aliascputime). โฐtimes,TIMEโ cumulative CPU time in seconds (aliascputimes). โณtname,TTYโ controlling tty (terminal). (aliastt,tty). ๐ฅ๏ธtpgid,TPGIDโ ID of the foreground process group on the tty (terminal) that the process is connected to, or-1if 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). (aliastname,tty). โจtty,TTโ controlling tty (terminal). (aliastname,tt). ๐ธucmd,CMDโ seecomm. (aliascomm,ucomm). ๐ucomm,COMMANDโ seecomm. (aliascomm,ucmd). ๐ซuid,UIDโ seeeuid. (aliaseuid). ๐uname,USERโ seeeuser. (aliaseuser,user). ๐unit,UNITโ displays unit which a process belongs to, if systemd support has been included. ๐งuser,USERโ seeeuser. (aliaseuser,uname). ๐ซถuserns,USERNSโ Unique inode number describing the namespace the process belongs to. Seenamespaces(7). ๐utsns,UTSNSโ Unique inode number describing the namespace the process belongs to. Seenamespaces(7). ๐ฆuunit,UUNITโ displays user unit which a process belongs to, if systemd support has been included. ๐vsize,VSZโ seevsz. (aliasvsz). ๐vsz,VSZโ virtual memory size of the process in KiB (1024-byte units). Device mappings are currently excluded; this is subject to change. (aliasvsize). 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 andpsis 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 ofposix,old,linux,bsd,sun,digital... (see section PERSONALITY below). ๐ญCMD_ENVโ Set to one ofposix,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-ooption. TheDefSysVandDefBSDvalues are particularly useful. โจPOSIXLY_CORRECTโ Don't find excuses to ignore bad "features". ๐POSIX2โ When set to"on", acts asPOSIXLY_CORRECT. ๐UNIX95โ Don't find excuses to ignore bad "features". ๐_XPGโ CancelCMD_ENV=irixnon-standard behavior. ๐ซ
okay so in general, it is a bad idea to set these variables. The one exception isCMD_ENVorPS_PERSONALITY, which could be set toLinuxfor normal systems. Without that setting,psfollows the useless and bad parts of the Unix98 standard. iykyk ๐
๐ญ PERSONALITY ๐ญ
390โ like the OS/390 OpenEditionpsaixโ like AIXpsbsdโ like FreeBSDps(totally non-standard)compaqโ like Digital Unixpsdebianโ like the old Debianpsdigitalโ like Tru64 (was Digital Unix, was OSF/1)psgnuโ like the old Debianpshpโ like HP-UXpshpuxโ like HP-UXpsirixโ like Irixpslinuxโ * recommended *oldโ like the original Linuxps(totally non-standard)os390โ like OS/390 Open Editionpsposixโ standards390โ like OS/390 Open Editionpsscoโ like SCOpssgiโ like Irixpssolaris2โ like Solaris 2+ (SunOS 5)pssunos4โ like SunOS 4 (Solaris 1)ps(totally non-standard)svr4โ standardsysvโ standardtru64โ like Tru64 (was Digital Unix, was OSF/1)psunixโ standardunix95โ standardunix98โ standard
๐ SEE ALSO ๐
bestie, go peek at pgrep(1), pstree(1), top(1), and proc(5). ๐
๐ STANDARDS ๐
This ps conforms to:
- Version 2 of the Single Unix Specification
- The Open Group Technical Standard Base Specifications, Issue 6
- IEEE Std 1003.1, 2004 Edition
- X/Open System Interfaces Extension [UP XSI]
- 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
- centos-stream 9: procps-ng 3.3.17-15.el9 ยท GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
- centos-stream 9: procps-ng 3.3.17-15.el9 ยท GPL+ and GPLv2 and GPLv2+ and GPLv3+ and LGPLv2+
- ubuntu jammy: procps 2:3.3.17-6ubuntu2 ยท LGPL-2.1-or-later
- ubuntu jammy: procps 2:3.3.17-6ubuntu2.1 ยท LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms