• 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 Examples in Linux

by admin

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.

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. addr2line: command not found
  2. fwupdmgr Command Examples in Linux
  3. How to Find Filesystem Inode Utilization in Linux
  4. How to disable the default apache “Welcome Page” in CentOS/RHEL 7
  5. How the BASH Shell load its configuration files in Linux
  6. Ubuntu: Changing the stripe size of a striped LVM volume
  7. CentOS / RHEL : How to add new swap partition
  8. How to Provide Credentials From a File While Mounting CIFS Share in Linux
  9. reboot Command Examples in Linux
  10. Linux: No space left on device while df command shows a lot of free space

You May Also Like

Primary Sidebar

Recent Posts

  • qm Command Examples in Linux
  • qm wait Command Examples in Linux
  • qm start Command Examples in Linux
  • qm snapshot Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright