Ps: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(15 intermediate revisions by the same user not shown) | |||
Line 5: | Line 5: | ||
=Overview= | =Overview= | ||
ps gets its information from [[/proc/pid/stat|/proc/<pid>/stat]] files. | |||
=Installation= | |||
==Ubuntu== | |||
<syntaxhighlight lang=text> | |||
apt-get install -y procps | |||
</syntaxhighlight> | |||
=Options= | =Options= | ||
Line 25: | Line 33: | ||
Hierarchical display of the process tree. | Hierarchical display of the process tree. | ||
==--no-headers== | |||
Skips the display of the header line. Useful when counting lines in the ps output with <tt>wc -l</tt>. | |||
==-l== | |||
Displays the [[Linux_General_Concepts#Process_States|process state]] ([[#S|S]]) and, if [[Linux_General_Concepts#Interruptible_Sleep_.28S.29|sleeping]], what kernel channel it is waiting on ([[#WCHAN|WCHAN]]). | |||
==Generic Attributes== | |||
Any process attribute can be obtained with | |||
ps <''pid''> -o <''format''> | |||
where <''format''> is the attribute label. | |||
=Columns= | =Columns= | ||
Line 33: | Line 57: | ||
The thread ID. | The thread ID. | ||
==NLWP== | |||
The number of threads for the process. | |||
==S== | |||
The [[Linux_General_Concepts#Process_States|process state]]. | |||
==WCHAN== | |||
If the process is [[Linux_General_Concepts#Interruptible_Sleep_.28S.29|sleeping]], shows the kernel channel the process is waiting on. | |||
==TTY== | |||
The [[Linux_TTY#TTY_Device_Components|TTY device]] character device file, relative to /dev. | |||
==SESS== | |||
The process' [[Linux_General_Concepts#Session|session]] ID. |
Latest revision as of 01:26, 20 September 2020
Internal
Overview
ps gets its information from /proc/<pid>/stat files.
Installation
Ubuntu
apt-get install -y procps
Options
-A, -e
Select all processes. -A and -e are identical.
-f
Full-format listing.
-L
Show threads.
The thread ID is listed under the "LWP" column.
--forest
Hierarchical display of the process tree.
--no-headers
Skips the display of the header line. Useful when counting lines in the ps output with wc -l.
-l
Displays the process state (S) and, if sleeping, what kernel channel it is waiting on (WCHAN).
Generic Attributes
Any process attribute can be obtained with
ps <pid> -o <format>
where <format> is the attribute label.
Columns
PID
LWP
The thread ID.
NLWP
The number of threads for the process.
S
The process state.
WCHAN
If the process is sleeping, shows the kernel channel the process is waiting on.
TTY
The TTY device character device file, relative to /dev.
SESS
The process' session ID.