Linux查看最消耗内存,CPU资源的进程

1. 查看消耗CPU资源最多的前10个进程

[root@localhost ~]# ps auxw | head -1;ps auxw |sort -rn -k3 |head -11
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1456  4.7  1.4 1128168 28884 ?       S<l  Mar30 269:35 /usr/local/vpnserver/vpnserver execsvc
root     10763  1.0  0.0 110240  1176 pts/1    R+   17:00   0:00 ps auxw
zabbix   10522  0.0  0.1  81476  2344 ?        S    Apr02   0:05 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]   
zabbix   10521  0.0  0.0  81336  1532 ?        S    Apr02   0:19 /usr/sbin/zabbix_agentd: collector [idle 1 sec]          
zabbix   10519  0.0  0.0  81336  1420 ?        S    Apr02   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root       969  0.0  0.0      0     0 ?        S    Mar30   0:00 [kauditd]
root      9491  0.0  0.0 108316  1904 pts/0    Ss+  Mar31   0:00 -bash
root      9486  0.0  0.2 100060  4060 ?        Ss   Mar31   0:00 sshd: root@pts/0 
root       916  0.0  0.0      0     0 ?        S    Mar30   0:00 [ext4-dio-unwrit]
root       915  0.0  0.0      0     0 ?        S    Mar30   0:00 [jbd2/sda2-8]
[root@localhost ~]#

2. 查看消耗内存资源最多的前10个进程

[root@localhost ~]# ps auxw | head -1;ps auxw |sort -rn -k4 |head -11
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      1456  4.7  1.4 1128168 28884 ?       S<l  Mar30 269:49 /usr/local/vpnserver/vpnserver execsvc
root      9486  0.0  0.2 100060  4060 ?        Ss   Mar31   0:00 sshd: root@pts/0 
root     10449  0.0  0.2 100056  4036 ?        Ss   Apr02   0:00 sshd: root@pts/1 
zabbix   10522  0.0  0.1  81476  2344 ?        S    Apr02   0:05 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec]   
root      9082  0.0  0.1  12016  2276 ?        S<   Mar30   0:00 /sbin/udevd -d
root      9068  0.0  0.1  12140  2404 ?        S<   Mar30   0:00 /sbin/udevd -d
root      1426  0.0  0.1  81012  3464 ?        Ss   Mar30   0:01 /usr/libexec/postfix/master
postfix   1431  0.0  0.1  81260  3484 ?        S    Mar30   0:00 qmgr -l -t fifo -u
postfix  10748  0.0  0.1  81092  3440 ?        S    15:47   0:00 pickup -l -t fifo -u
zabbix   10521  0.0  0.0  81336  1532 ?        S    Apr02   0:19 /usr/sbin/zabbix_agentd: collector [idle 1 sec]          
zabbix   10519  0.0  0.0  81336  1420 ?        S    Apr02   0:00 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
[root@localhost ~]# 

3. 如下指令也是同样效果(按照cpu,内存等)

ps auxw --sort=rss
ps auxw --sort=%cpu
ps auxw --sort=%mem

4. 几个参数的含义

  1. %MEM 进程的内存占用率

  2. MAJFL is the major page fault count,

  3. VSZ 进程所使用的虚存的大小

  4. RSS 进程使用的驻留集大小或者是实际内存的大小(RSS is the "resident 5. set size" meaning physical memory used)

  5. TTY 与进程关联的终端(tty)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值