在 Unix / Linux 系统中,查看系统进程的常用方法如下:
ps(查看当前进程快照)ps
常用组合:
ps aux
ps -ef
top(实时查看进程)top
q 退出增强版:
htop
(需安装,更友好)
pstree(进程树)pstree
或:
pstree -p
ps aux | grep nginx
或使用:
pgrep nginx
ps -p 1234 -o pid,ppid,cmd,%cpu,%mem
lsof -p 1234
cat /proc/1234/environ
| 系统 | 推荐命令 |
|---|---|
| Linux | ps aux, top, htop |
| macOS | ps aux, top -l 1 |
| Solaris | prstat, ps -ef |
| FreeBSD | ps aux, top |
查看内存占用最高的进程:
ps aux --sort=-%mem | head
查看 CPU 占用最高的进程:
ps aux --sort=-%cpu | head
如果你是 想查某个具体进程 / 杀进程 / 看资源占用,可以告诉我你的系统和使用场景。
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。