When something goes wrong on your Linux server or desktop, is important to understand which process is taking all the resources, in the past I’ve published some information about
htop, two great tools to have a general overview of your system with just a glance, but sometimes you need to gather more information of a particular process and for this task the command
pidstat is perfect.
Pidstat is a statistics report tool for Linux which is part of the sysstat utilities. 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. Not selecting any tasks is equivalent to specifying -p ALL but only active tasks (tasks with non-zero statistics values) will appear in the report.
You can use PID’s and even regular expressions on the process names to filter them out.