如何查看系统有哪些进程?( ps,top指令)
程序员文章站
2022-06-24 20:35:15
...
2.如何查看系统有哪些进程?
指令:ps
[email protected]_Learn:~$ ps
PID TTY TIME CMD
3881 pts/2 00:00:00 bash
4120 pts/2 00:00:00 ps
但这只能查看部分的进程信息,可以通过ps -aux 查看全部进程信息。
[email protected]_Learn:~$ ps -aux
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.1 24608 2552 ? Ss 13:18 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? S 13:18 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 13:18 0:00 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< 13:18 0:00 [kworker/0:0H]
.
.
.
可以通过指令组合管道过滤查看某个进程的信息 ps -aux|grep bash
[email protected]_Learn:~$ ps -aux|grep bash
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
CLC 3105 0.0 0.2 27864 4848 pts/0 Ss+ 13:56 0:00 bash
CLC 3372 0.0 0.4 31756 8808 pts/1 Ss+ 13:57 0:00 -bash
CLC 3881 0.0 0.4 31752 8800 pts/2 Ss 14:27 0:00 -bash
CLC 4124 0.0 0.0 13588 940 pts/2 R+ 16:15 0:00 grep --color=auto bash
通过指令top可以实时看看进程信息,相当于windows的任务管理器
@Embed_Learn:~$ top
top - 16:19:31 up 3:01, 4 users, load average: 0.00, 0.01, 0.05
Tasks: 330 total, 3 running, 327 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.2%us, 0.7%sy, 0.0%ni, 99.2%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 1905156k total, 1060652k used, 844504k free, 95028k buffers
Swap: 5998588k total, 0k used, 5998588k free, 483808k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
2798 CLC 9 -11 418m 5956 4144 S 2 0.3 3:12.62 pulseaudio
1404 root 20 0 203m 49m 11m S 1 2.6 0:48.73 Xorg
2787 CLC 20 0 1166m 70m 35m R 1 3.8 0:53.31 compiz
1996 root 20 0 93656 4600 3728 S 0 0.2 0:09.16 vmtoolsd
下一篇: 终止进程,回收子进程