pidstat helps monitoring processes on their CPU, memory, and disk activity


When pidstat is not installed by default, it can be added to the system using the relevant software package.

Package information for pidstat

Operating systemPackage nameInstallation
dnf install sysstat
Arch Linuxsysstat
pacman -S sysstat
apt install sysstat
dnf install sysstat
Red Hat Enterprise Linuxsysstat
dnf install sysstat
Rocky Linuxsysstat
dnf install sysstat
apt install sysstat

Your Linux distribution using a different package? Share your feedback.


Available options

-C NAMEDefine task(s) to monitor, may be using regular expression
-dShow disk activity
--dec=0|1|2Set number of decimals, with 2 being the default
-e COMMAND ARGSExecute a COMMAND (with arguments ARGS) and monitor it with pidstat
-G NAMEDefine process name(s) to monitor, may be using regular expression, can be used with -t
-HInclude timestamp (seconds since epoch)
-hDo not include summary, all output on one line, making it easier to parse by external tools
--humanHuman-readable formats
-IDivide CPU usage by total number of processors, for SMP environments
-lInclude full command and arguments
-p { pid[,pid2,pid3] | SELF | ALL}Monitor only one process, multiple processes, pidstat itself, or all
-RShow information about realtime priority and scheduling
-rShow page faults and memory usage
-sShow stack usage
-T { TASK, CHILD, ALL}Define what should be included for tasks.
-tInclude threads with selected tasks, can be used with -G
-UShow username instead of UID
-uShow CPU usage statistics
-VShow version number
-vShow information about some kernel tables
-wShow task switching activities

Missing an option in this overview? Share your feedback.

Examples using pidstat

CPU usage monitoring with interval

Run pidstat with interval of 3 seconds

pidstat 3 

Limit number of reports

Run pidstat with interval of 5 seconds, repeat 12 times (=60 seconds), then stop

pidstat 5 12

Disk activity

Show disk activity per process

pidstat -d 3

Single process monitoring

Start Chrome and monitor it, show details every 3 seconds, until Chrome is closed

pidstat 3 -e /opt/google/chrome/chrome

Relevant articles using the pidstat command

The following articles include an example on how to use pidstat and might be worth further exploring.