在 Debian 系统中,如果发现某个进程占用 CPU 或内存过高,可以按下面步骤排查和处理。
top
或更好用的:
htop
(如未安装:sudo apt install htop)
关注:
ps aux | grep 进程名
或按 PID 查看:
ps -fp PID
kill PID
kill -9 PID
⚠️ 不要随意 kill 系统关键进程(如 systemd, dbus, sshd)
如 mysql、nginx、docker、java 等:
systemctl status 服务名
重启服务:
sudo systemctl restart 服务名
查看内存:
free -h
如果是内存太小:
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches
特征:
排查:
netstat -antlp
ss -antlp
ps -ef
处理:
kill -9 PID
并排查:
/tmp、/var/tmpcrontab -l
sudo crontab -l
systemctl set-property 服务名 CPUQuota=50%
journalctl -xe
/var/log/syslog
top / htopkill 或 restart如果你愿意,可以把 top 或 ps aux 的输出贴出来,我可以帮你具体分析是哪一个进程、该不该杀、怎么优化。