如果你只想查看命令名称而不是命令的绝对路径,请使用下面的 top 命令格式。
# top -b -o +%MEM | head -n 20 | tail -15 -
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 1064 mysql 20 0 886076 210340 8388 S 6.7 5.4 62:40.93 mysqld 23396 varnish 20 0 286492 115616 83572 S 0.0 3.0 0:42.24 cache-main 1105 named 20 0 311712 108204 2424 S 0.0 2.8 0:16.41 named 23377 nobody 20 0 153240 89432 2432 S 13.3 2.3 4:35.74 nginx 23376 nobody 20 0 147096 83316 2416 S 0.0 2.1 2:18.09 nginx 23375 root 20 0 131028 66764 1616 S 0.0 1.7 0:01.07 nginx 23378 nobody 20 0 130988 64592 592 S 0.0 1.7 0:00.51 nginx 1135 root 20 0 86708 37572 2252 S 0.0 1.0 0:20.18 cwpsrv 1133 root 20 0 86708 37544 2212 S 0.0 1.0 0:05.94 cwpsrv 3034 root 20 0 86704 36740 1452 S 0.0 0.9 0:00.09 cwpsrv 1067 nobody 20 0 1356200 31588 2352 S 0.0 0.8 0:56.04 httpd 977 nobody 20 0 1356088 31268 2372 S 0.0 0.8 0:30.44 httpd 968 nobody 20 0 1356216 30544 2348 S 0.0 0.8 0:19.95 httpd
3) 奖励技巧:如何使用 ps_mem 命令在 Linux 中查找内存消耗最大的进程
ps_mem 程序 用于显示每个程序(而不是每个进程)使用的核心内存。该程序允许你检查每个程序使用了多少内存。它根据程序计算私有和共享内存的数量,并以最合适的方式返回已使用的总内存。
它使用以下逻辑来计算内存使用量。总内存使用量 = sum(用于程序进程的专用内存使用量) + sum(用于程序进程的共享内存使用量)。
# ps_mem -
Private + Shared = RAM used Program 128.0 KiB + 27.5 KiB = 155.5 KiB agetty 228.0 KiB + 47.0 KiB = 275.0 KiB atd 284.0 KiB + 53.0 KiB = 337.0 KiB irqbalance 380.0 KiB + 81.5 KiB = 461.5 KiB dovecot 364.0 KiB + 121.5 KiB = 485.5 KiB log 520.0 KiB + 65.5 KiB = 585.5 KiB auditd 556.0 KiB + 60.5 KiB = 616.5 KiB systemd-udevd 732.0 KiB + 48.0 KiB = 780.0 KiB crond 296.0 KiB + 524.0 KiB = 820.0 KiB avahi-daemon (2) 772.0 KiB + 51.5 KiB = 823.5 KiB systemd-logind 940.0 KiB + 162.5 KiB = 1.1 MiB dbus-daemon 1.1 MiB + 99.0 KiB = 1.2 MiB pure-ftpd 1.2 MiB + 100.5 KiB = 1.3 MiB master 1.3 MiB + 198.5 KiB = 1.5 MiB pickup 1.3 MiB + 198.5 KiB = 1.5 MiB bounce 1.3 MiB + 198.5 KiB = 1.5 MiB pipe 1.3 MiB + 207.5 KiB = 1.5 MiB qmgr 1.4 MiB + 198.5 KiB = 1.6 MiB cleanup 1.3 MiB + 299.5 KiB = 1.6 MiB trivial-rewrite 1.5 MiB + 145.0 KiB = 1.6 MiB config 1.4 MiB + 291.5 KiB = 1.6 MiB tlsmgr 1.4 MiB + 308.5 KiB = 1.7 MiB local 1.4 MiB + 323.0 KiB = 1.8 MiB anvil (2) 1.3 MiB + 559.0 KiB = 1.9 MiB systemd-journald 1.8 MiB + 240.5 KiB = 2.1 MiB proxymap 1.9 MiB + 322.5 KiB = 2.2 MiB auth 2.4 MiB + 88.5 KiB = 2.5 MiB systemd 2.8 MiB + 458.5 KiB = 3.2 MiB smtpd 2.9 MiB + 892.0 KiB = 3.8 MiB bash (2) 3.3 MiB + 555.5 KiB = 3.8 MiB NetworkManager 4.1 MiB + 233.5 KiB = 4.3 MiB varnishd 4.0 MiB + 662.0 KiB = 4.7 MiB dhclient (2) 4.3 MiB + 623.5 KiB = 4.9 MiB rsyslogd 3.6 MiB + 1.8 MiB = 5.5 MiB sshd (3) 5.6 MiB + 431.0 KiB = 6.0 MiB polkitd 13.0 MiB + 546.5 KiB = 13.6 MiB tuned 22.5 MiB + 76.0 KiB = 22.6 MiB lfd - sleeping 30.0 MiB + 6.2 MiB = 36.2 MiB php-fpm (6) 5.7 MiB + 33.5 MiB = 39.2 MiB cwpsrv (3) 20.1 MiB + 25.3 MiB = 45.4 MiB httpd (5) 104.7 MiB + 156.0 KiB = 104.9 MiB named 112.2 MiB + 479.5 KiB = 112.7 MiB cache-main 69.4 MiB + 58.6 MiB = 128.0 MiB nginx (4) 203.4 MiB + 309.5 KiB = 203.7 MiB mysqld --------------------------------- 775.8 MiB =================================
(编辑:西双版纳站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|