在 Debian 系统中,cpustat 工具通常包含在 sysstat 软件包中。以下是安装和使用步骤:
sudo apt update
sudo apt install sysstat
安装完成后,cpustat 命令即可使用。
cpustat --version
或
which cpustat
cpustat
cpustat 2 5
cpustat -c
在某些较老或精简的 Debian 版本中,cpustat 可能不在 sysstat 里,可以尝试:
apt search cpustat
sudo apt install git make gcc
git clone https://github.com/uber-common/cpustat.git
cd cpustat
make
sudo cp cpustat /usr/local/bin/
大部分情况下不需要 root 权限即可运行,但若需要查看所有进程信息,可使用:
sudo cpustat
如果你告诉我 Debian 版本(如 11 / 12) 或 你是想在服务器还是桌面环境使用,我可以给你更精确的方案。