在 CentOS 中,cpustat 并不是系统默认自带的命令,它通常来自 sysstat 工具包(或某些第三方工具包)。停止 cpustat 的方式取决于你 是如何启动它的。下面按常见情况说明:
如果你是在终端直接执行了类似命令:
cpustat
或
cpustat 1
✅ 停止方法:
ps -ef | grep cpustat
或
pgrep -a cpustat
示例输出:
root 12345 1 0 10:00 ? 00:00:01 cpustat 1
kill 12345
如果无法停止:
kill -9 12345
有些系统会把 cpustat 做成服务。
systemctl status cpustat
sudo systemctl stop cpustat
sudo systemctl disable cpustat
nohup cpustat 1 > cpu.log &
停止方法仍是:
pkill cpustat
或更精确:
ps -ef | grep cpustat
kill PID
pkill cpustat
或
killall cpustat
⚠️ 在服务器环境中慎用
killall,可能误杀同名进程。
ps -ef | grep cpustat
如果没有输出,说明已停止。
如果你能贴出:
cpustat 的完整启动命令ps -ef | grep cpustat 的输出我可以帮你 精确判断用哪种方式最安全。