你提到的 “centos cpustat为何没”,我猜你是想问:CentOS 上为什么没有 cpustat 命令 / 为什么用不了 cpustat。下面给你说清楚原因和解决办法。
cpustatcpustat 不是系统自带命令在 CentOS / RHEL 中:
cpustat 不是核心工具procps、util-linux 等基础包cpustat 来自哪个包?cpustat 通常来自:
sysstat 扩展工具(非标准)cpustat by Colin Ian King)CentOS 官方仓库 默认不包含
cpustat
如果你只是想看 CPU 使用率,其实 不需要 cpustat:
toptop
htop(需安装)yum install epel-release -y
yum install htop -y
htop
mpstat(推荐,接近 cpustat)yum install sysstat -y
mpstat 1
vmstatvmstat 1
/proc/statcat /proc/stat
git clone https://github.com/ckulka/cpustat.git
cd cpustat
make
./cpustat
需要自行找可信源,不建议生产服务器随便装。
CentOS 没有
cpustat,是因为它不属于官方基础工具集,默认不提供。
如果你愿意,可以告诉我:
我可以给你最合适的命令或脚本。