pidstat
Monitor individual tasks managed by the Linux kernel
TLDR
SYNOPSIS
pidstat [-d] [-H] [-h] [-I] [-l] [-R] [-r] [-s] [-t] [-U [username]] [-u] [-v] [-w] [-C comm] [-G processname] [--human] [-o JSON] [-p {pid|SELF|ALL}] [-T {TASK|CHILD|ALL}] [interval] [count] [-e program args_]
DESCRIPTION
pidstat is used for monitoring individual tasks currently being managed by the Linux kernel. It reports CPU usage, memory utilization, I/O statistics, context switches, and other resource usage for selected processes or all tasks.
PARAMETERS
-d
Display I/O statistics (disk reads/writes, I/O delays)-r
Report page faults and memory utilization metrics-u
Show CPU usage percentages (default if no option specified)-w
Display voluntary and involuntary context switches-s
Report stack memory usage-t
Include thread statistics for selected tasks-p {pid|SELF|ALL}
Select specific process(es), current process, or all tasks-T {TASK|CHILD|ALL}
Monitor individual tasks, children, or both-C comm
Filter by command name using regex patterns-G process_name
Display processes matching name pattern-l
Show full command names with arguments--human
Format output in human-readable sizes (1.0k, 1.2M)-e program args
Execute and monitor a specific program-h
Show all activities horizontally on a single line; omits average statistics at end of report-H
Display timestamp in seconds since epoch-I
In SMP environments, divide CPU usage by total number of processors-o JSON
Output statistics in JSON format-R
Report realtime priority and scheduling policy information-U [username]
Display real username of the tasks; optionally filter by specified user-v
Report values of kernel tables: number of threads and file descriptors--dec={0|1|2}
Specify the number of decimal places to use (default: 2)
CAVEATS
When using -e to run and monitor a program, a non-zero interval value must be specified. The interval and count parameters control reporting frequency and duration.The `/proc` filesystem must be mounted for pidstat to work. Specifying an interval of 0 or omitting it reports statistics accumulated since system startup.
HISTORY
pidstat is part of the sysstat package, developed by Sebastien Godard. It provides per-process statistics that complement system-wide tools like mpstat and iostat.
