在 CentOS 上你执行 cpustat 却“没用 / 找不到命令”,一般不是系统坏了,而是下面几种常见原因之一。
cpustat 命令cpustat 不是 CentOS 自带命令,而是 sysstat 工具集里的一个较新工具,很多 CentOS 版本:
mpstat、sar,❌ 通常 没有 cpustatcpustat你可以先确认:
which cpustat
如果输出为空,就是没装或不存在。
cpustat 来自 sysstat 包:
yum install -y sysstat
# 或
dnf install -y sysstat
装完后检查版本:
rpm -q sysstat
⚠️ CentOS 7 的 sysstat 版本一般 11.x 以下,不含 cpustat
在 CentOS 上,99% 场景不需要 cpustat:
top
htop
mpstat -P ALL 1
sar -u 1 3
uptime
只能:
❌ cpustat ≠ cpu stat
❌ 不是内核自带工具
❌ 不是 cat /proc/cpuinfo
CentOS 上“cpustat 没用”通常是因为它根本不存在,用
mpstat或top就行。
如果你愿意,可以告诉我:
cat /etc/redhat-release)我可以直接给你最合适的一条命令。