• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

pidstat: command not found

by Deepika

While top is used to get an overview of all running processes, the command pidstat can be used to monitor CPU utilization by an individual process or program. Use the following command to monitor CPU consumed by MySQL (or any other task name):

$ pidstat -C mysql

pidstat Command Examples in Linux

With pidstat, you can also query statistics for a specific process by its process ID or PID, as follows:

$ pidstat -p 1254

The pidstat application may not be installed by default. It can be installed with this command:

# apt-get install sysstat

or

# yum install sysstat

The pidstat application has several options for generating different reports:

  • -d: This reports IO statistics.
  • -r: This reports page faults and memory utilization.
  • -u: This reports CPU utilization.
  • -w: This reports task switches.

If you encounter the below error while running the command pidstat:

pidstat: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
Debian apt-get install sysstat
Ubuntu apt-get install sysstat
Alpine apk add sysstat
Arch Linux pacman -S sysstat
Kali Linux apt-get install sysstat
CentOS yum install sysstat
Fedora dnf install sysstat
Raspbian apt-get install sysstat

pidstat Command Examples in Linux

1. To report statistics for Linux tasks:

# pidstat 

2. To display only tasks whose command name includes the string comm:

# pidstat -C comm 

3. To report I/O statistics:

# pidstat -d  

4. To display all activities horizontally on a single line:

# pidstat -h 

5. To display the process command name and all its arguments:

# pidstat -l  

6. To select tasks (processes) for which statistics are to be reported:

# pidstat -p 1234 

7. To report page faults and memory usage:

# pidstat -r 

8. To display statistics for threads associated with selected tasks:

# pidstat -t 

9. To specifies what has to be monitored by the pidstat command:

# pidstat -T 

10. To report CPU usage:

# pidstat -u 

11. To print version info:

# pidstat -V 

12. To Report task switching activity:

# pidstat -w 

Conclusion

The pidstat application queries the kernel to get task information. The pidstat program will report per-process statistics, which can be sorted to provide more insight.

Filed Under: Linux

Some more articles you might also be interested in …

  1. a2enmod Command Examples in Linux
  2. needrestart Command Examples in Linux
  3. How to view file size/details from ls command in Unix
  4. pvck Command Examples in Linux
  5. loadkeys Command Examples in Linux
  6. cryptcat Command Examples in Linux
  7. “Authorization not available. Check if polkit service is running or see debug message for more information” – CentOS/RHEL 7 ssh service error
  8. groupadd: command not found
  9. Cannot Increase “nproc” Value More Than 1024 in CentOS/RHEL 6
  10. Understanding SELinux File Labelling and SELinux Context

You May Also Like

Primary Sidebar

Recent Posts

  • protonvpn-cli Command Examples in Linux
  • protonvpn-cli connect Command Examples
  • procs Command Examples in Linux
  • prlimit: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright