Linux "pidstat" Command Line Options and Examples
Report statistics for Linux tasks.

The pidstat command is used for monitoring individual tasks currently being managed by the Linux kernel. It writes to standard output activities for every task selected with option -p or for every task managed by the Linux kernel if option -p ALL has been used.


Usage:

pidstat [ -d ] [ -H ] [ -h ] [ -I ] [ -l ] [ -R ] [ -r ] [ -s ] [ -t ] [ -U [ username ] ] [ -u ] [ -V ] [ -v
] [ -w ] [ -C comm ] [ -G process_name ] [ --human ] [ -p { pid [,...] | SELF | ALL } ] [ -T { TASK | CHILD |
ALL } ] [ interval [ count ] ] [ -e program args ]






Command Line Options:

-C
Display only tasks whose command name includes the string comm. This string can be a regular expres‐sion.
pidstat -C ...
-e
Execute program with given arguments args and monitor it with pidstat. pidstat stops when program ter‐minates.
pidstat -e ...
-G
Display only processes whose command name includes the string process_name. This string can be a regu‐lar expression. If option -t is used together with option -G then the threads belonging to that processare also displayed (even if their command name doesn't include the string process_name).
pidstat -G ...
-H
Display timestamp in seconds since the epoch.
pidstat -H ...
--human
Print sizes in human readable format (e.g. 1k, 1.23M, etc.) The units displayed with this optionsupersede any other default units (e.g. kilobytes, sectors...) associated with the metrics.
pidstat --human ...
-l
Display the process command name and all its arguments.
pidstat -l ...
-p
Select tasks (processes) for which statistics are to be reported. pid is the process identificationnumber. The SELF keyword indicates that statistics are to be reported for the pidstat process itself,whereas the ALL keyword indicates that statistics are to be reported for all the tasks managed by thesystem.
pidstat -p ...
-r
When reporting statistics for individual tasks, the following values may be displayed:UIDThe real user identification number of the task being monitored.USERThe name of the real user owning the task being monitored.PIDThe identification number of the task being monitored.minflt/sTotal number of minor faults the task has made per second, those which have not required loadinga memory page from disk.majflt/sTotal number of major faults the task has made per second, those which have required loading amemory page from disk.VSZVirtual Size: The virtual memory usage of entire task in kilobytes.RSSResident Set Size: The non-swapped physical memory used by the task in kilobytes.%MEMThe tasks's currently used share of available physical memory.CommandThe command name of the task.When reporting global statistics for tasks and all their children, the following values may be dis‐played:UIDThe real user identification number of the task which is being monitored together with its chil‐dren.USERThe name of the real user owning the task which is being monitored together with its children.PIDThe identification number of the task which is being monitored together with its children.minflt-nrTotal number of minor faults made by the task and all its children, and collected during theinterval of time.majflt-nrTotal number of major faults made by the task and all its children, and collected during theinterval of time.CommandThe command name of the task which is being monitored together with its children.
pidstat -r ...
-s
UIDThe real user identification number of the task being monitored.USERThe name of the real user owning the task being monitored.PIDThe identification number of the task being monitored.StkSizeThe amount of memory in kilobytes reserved for the task as stack, but not necessarily used.StkRefThe amount of memory in kilobytes used as stack, referenced by the task.CommandThe command name of the task.
pidstat -s ...
-T
This option specifies what has to be monitored by the pidstat command. The TASK keyword indicates thatstatistics are to be reported for individual tasks (this is the default option) whereas the CHILD key‐word indicates that statistics are to be globally reported for the selected tasks and all their chil‐dren. The ALL keyword indicates that statistics are to be reported for individual tasks and globallyfor the selected tasks and their children.Note: Global statistics for tasks and all their children are not available for all options of pidstat.Also these statistics are not necessarily relevant to current time interval: The statistics of a childprocess are collected only when it finishes or it is killed.
pidstat -T ...
-t
This option adds the following values to the reports:TGIDThe identification number of the thread group leader.TIDThe identification number of the thread being monitored.
pidstat -t ...
-U
Display the real user name of the tasks being monitored instead of the UID. If username is specified,then only tasks belonging to the specified user are displayed.
pidstat -U ...
-u
When reporting statistics for individual tasks, the following values may be displayed:UIDThe real user identification number of the task being monitored.USERThe name of the real user owning the task being monitored.PIDThe identification number of the task being monitored.%usrPercentage of CPU used by the task while executing at the user level (application), with orwithout nice priority. Note that this field does NOT include time spent running a virtual pro‐cessor.%systemPercentage of CPU used by the task while executing at the system level (kernel).%guestPercentage of CPU spent by the task in virtual machine (running a virtual processor).%waitPercentage of CPU spent by the task while waiting to run.%CPUTotal percentage of CPU time used by the task. In an SMP environment, the task's CPU usage willbe divided by the total number of CPU's if option -I has been entered on the command line.CPUProcessor number to which the task is attached.CommandThe command name of the task.When reporting global statistics for tasks and all their children, the following values may be dis‐played:UIDThe real user identification number of the task which is being monitored together with its chil‐dren.USERThe name of the real user owning the task which is being monitored together with its children.PIDThe identification number of the task which is being monitored together with its children.usr-msTotal number of milliseconds spent by the task and all its children while executing at the userlevel (application), with or without nice priority, and collected during the interval of time.Note that this field does NOT include time spent running a virtual processor.system-msTotal number of milliseconds spent by the task and all its children while executing at the sys‐tem level (kernel), and collected during the interval of time.guest-msTotal number of milliseconds spent by the task and all its children in virtual machine (runninga virtual processor).CommandThe command name of the task which is being monitored together with its children.
pidstat -u ...
-V
Print version number then exit.
pidstat -V ...
-v
UIDThe real user identification number of the task being monitored.USERThe name of the real user owning the task being monitored.PIDThe identification number of the task being monitored.threadsNumber of threads associated with current task.fd-nrNumber of file descriptors associated with current task.CommandThe command name of the task.
pidstat -v ...