Linux command
pidstat 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Example
pidstat 2 10
Example
pidstat -r
Example
pidstat -d
Example
pidstat -p 1234
Example
pidstat -C "pattern" -r -p ALL
Example
pidstat -w
Execute and monitor
pidstat -e [program] [args] 1
Example
pidstat -o JSON 1 5
说明
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.
参数
- -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)
FAQ
What is the pidstat command used for?
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.
How do I run a basic pidstat example?
Run `pidstat 2 10` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -d do in pidstat?
Display I/O statistics (disk reads/writes, I/O delays)