Monitor and Find Statistics for Linux Processes Using pidstat Tool
Last Updated :
22 Dec, 2022
Pidstat is a command-line tool and part of sysstat suite to monitor the Linux system. It is used to monitor every individual task currently being managed by the Linux kernel on the Linux system.
Features of pistat:
- It can monitor every task running on the system
- It can also monitor the child’s task of any task.
- It shows the total CPU usage by every task.
- It can monitor read and write data on disk by the task.
Now, let’s see how to install pidstat on the system. As we see before pidstat is part of sysstat suite therefore we need to install the sysstat on the system.
To install on Debian based system like ubuntu or kali Linux run the command:
sudo apt-get install sysstat
To install on systems like CentOS / Fedora / RHEL Linux run the command:
yum install sysstat
How to Use pidstat?
To monitor specific task running on a system run the pidstat with -p argument and after -p argument write the PID of taste but to monitor all current active task on the system we can use pidstat -p All command which is equivalent to just pidstat command, Now let’s see how will be the output of pistat to see active tasks run the following command on terminal:
pidstat
Output:

Tuple information:
The output shows the following information about the system:
- Kernel: Pidstat show which Linux kernel running on the system.
- CPU architecture: It shows the architecture of the CPU whether it is 64 bit or 32 bit.
- No. Of CPUs: This shows the total no. of processors in the system.
pidstat show the following common information about the tasks:
- UID: UID is a user identifier assigned by the Linux system to every user on the system. 0 UID is reserved for root.
- PID: PID is the process ID. This is a unique number assigned to every process running on the system by using PID system to identify the processes.
- %usr: Percentage of CPU usage by the process at the user level.
- %system: Percentage of CPU usage by the process at system level or kernel level
- %guest: Percentage of CPU usage by the process Percentage of CPU spent by the task in a virtual machine (running a virtual processor).
- %CPU: Total Percentage of CPU usage by that task.
- CPU: This field shows the processor number task on which that task is running.
- Command: The filed shows the command name of that task.
Now let’s see some options or arguments we can use with pidstat. The following are the arguments we can use with pistat:
1) -C string: This argument shows the tasks which contain the given string in their command name. To use the -C option with the pidstat run the following command:
pidstat -C string
The following image shows the output of pidstat with the -C option and sys as a string. We can see that this output contains tasks that contain sys in their command name.

2) -d: This option shows the output similar to pidstat command but with some different information about the system. To use the -d option on the system use the following command.
pidstat -d
The following image shows the output of the command :

Let’s see what are the different terms:
- kB_rd/s: Number of kilobytes the task has caused to be read from disk per second.
- kB_wr/s: Number of kilobytes the task has caused to be written to disk per second
- kB_ccwr/s: Number of kilobytes whose writing to disk has been cancel by the task
3) -w: This is the argument that shows the task switching activity of tasks following is the output of the command

In this output there are two different terms we can see:
- cswch/s: Total number of voluntary context switches the task made per second.
- nvcswch/s: Total number of non-voluntary context switches the task made per second.
4) -t: This option is used to display statistics for threads associated with selected tasks. The output pidstat with this command is

In this output, there are two different terms we can see:
- TGID: TGID is the identification number of the thread group leader.
- TID: The identification number of the thread being monitored.
5) -p: With this argument, we can see information about the specific task by using its PID. Following is the command to use the -p option.
pidstat -p PID
Output:

Similar Reads
Using htop to Monitor System Processes on Linux
htop a Linux tool that is used in process-managing and terminal-based system monitoring. It allows real-time monitoring of processes and performs every task to monitor the process in the Linux system. The tool is written in the C programming language by Hisham Muhammad. It displays a complete list o
5 min read
Monitoring Linux Users and Processes in Real Time Using whowatch
Whowatch is a console-based, interactive user and process monitoring tool. Whowatch shows the information about the user's currently logged on the machine, in real-time. It shows the information like login name, tty, host, user's processes of logging user's. whowatch shows all processes of the selec
2 min read
Sysdig - System Monitoring and Troubleshooting Tool For Linux
Sysdig is an open-source, cross-platform, system exploration/diagnosing and troubleshooting tool for Linux. Sysdig was written in Lua program language. Sysdig also has a simple, intuitive, powerful, and fully customizable curses UI (User Interface) called Csysdig. System state and activity from a ru
2 min read
How to Monitor System Usage, Outages and Troubleshoot Linux Servers
As we know that Linux is very reliable and a great system administrator should always know the system's behavior and its utilization at every moment of time. So if an administrator or a user wants to monitor its complete system then they have to do the following Storage Space Utilization Linux provi
5 min read
Linux Sysstat Utilities For Monitoring System Performance
Sysstat is a useful utility that includes a number of programs for monitoring system resources, performance, and use. The sysstat package contains a number of programs that we all use on a daily basis. It also includes a program that can be used to collect all performance and activity data. Installi
1 min read
SAR command in Linux to monitor system performance
sar (System Activity Report) It can be used to monitor Linux system's resources like CPU usage, Memory utilization, I/O devices consumption, Network monitoring, Disk usage, process and thread allocation, battery performance, Plug and play devices, Processor performance, file system and more. Linux s
9 min read
Progress - Tool to monitor progress of basic command in Linux
Progress is a command-line-based tiny tool which is formerly known as a Coreutils Progress Viewer. This tool is written in the C language. This command looks for the Coreutils basic command like cp, mv, dd, tar, gzip, cat, etc. which are currently running on the system and display the percentage of
2 min read
How to Install and Use Scout_Realtime to Monitor Server and Process Metrics in Linux?
There are numerous free tools on Linux that are used to monitor the Linux system including hardware and software. We all may have already come across some command-line Linux performance monitoring tools such as top, htop, atop, etc. Alike that we come across another tool called Scout Realtime tool w
2 min read
Installing atop Tool To Monitor the System Process in Linux
atop is an ASCII full-screen interactive performance monitor which is kind of similar to the top command to view the load over a Linux system. The job of the most critical hardware resources (from a performance point of view) at the system level, i.e. CPU, memory, disk, and network can be seen. atop
7 min read
How to List Running Processes in Linux | ps Command
As we all know Linux is a multitasking and multi-user system. So, it allows multiple processes to operate simultaneously without interfering with each other. Process is one of the important fundamental concepts of the Linux OS. A process is an executing instance of a program that carries out differe
9 min read