top中使用CPU或MEM排序,还是看不到我们想了解的进程的相关信息;
这时就可以指定对某个或某些进程进行TOP信息显示;
1、查看某个进程的信息
例:mysqld的信息
(1)得到mysqld进程的pid
[root@6 ~]# pidof mysqld
21538
(2)top指定查看PID
[root@6 ~]# top -p 21538
top - 09:15:06 up 30 days, 53 min, 3 users, load average: 0.07, 0.22, 0.23
Tasks: 1 total, 0 running, 1 sleeping, 0 stopped, 0 zombie
Cpu(s): 3.0%us, 6.9%sy, 0.2%ni, 89.4%id, 0.3%wa, 0.1%hi, 0.1%si, 0.0%st
Mem: 1035140k total, 994888k used, 40252k free, 383072k buffers
Swap: 2048248k total, 80k used, 2048168k free, 237456k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
21538 mysql 15 0 146m 21m 4372 S 0.0 2.1 3:03.84 mysqld