温馨提示×

Debian如何安装cpustat

小樊
47
2026-07-29 13:43:34
栏目: 智能运维

在 Debian 系统中,cpustat 工具通常包含在 sysstat 软件包中。以下是安装和使用步骤:


1. 更新软件包索引

sudo apt update

2. 安装 sysstat

sudo apt install sysstat

安装完成后,cpustat 命令即可使用。


3. 验证安装

cpustat --version

which cpustat

4. 基本使用示例

查看 CPU 使用情况

cpustat

每隔 2 秒刷新一次,共显示 5 次

cpustat 2 5

显示所有 CPU(包括每个核心)

cpustat -c

5. 如果找不到 cpustat

在某些较老或精简的 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/

6. 权限说明

大部分情况下不需要 root 权限即可运行,但若需要查看所有进程信息,可使用:

sudo cpustat

如果你告诉我 Debian 版本(如 11 / 12)你是想在服务器还是桌面环境使用,我可以给你更精确的方案。

0