在 Debian 系统中,查看进程列表有多种常用方法,下面按使用场景和命令给你总结一下:
ps(查看某一时刻的进程快照)ps aux
a:显示所有用户的进程u:显示详细信息(CPU、内存等)x:包括无控制终端的进程常见用法:
ps -ef
top(实时查看进程)top
q 退出htop(更友好的 top,需安装)sudo apt install htop
htop
systemctl status
查看某个服务:
systemctl status ssh
列出所有运行中的服务:
systemctl list-units --type=service
pgrep nginx
或:
ps aux | grep nginx
ps -p <PID> -o pid,ppid,cmd,%mem,%cpu
pstree(进程树结构)pstree
查看某用户:
pstree -u username
sudo ss -tulnp
或老命令:
sudo netstat -tulnp
top
htop
ps aux | grep 进程名
systemctl status 服务名
如果你有具体需求(比如:查某个服务、查占用 CPU 的进程、查僵尸进程),可以告诉我,我给你更针对性的命令。