smem -k -s ussPID User Command Swap USS PSS RSS15061 root sh /root/run.sh 0 116.0K 128.0K 396.0K15650 root sh /root/run.sh 0 116.0K 128.0K 396.0K30284 root sh /root/run.sh 0 116.0K 128.0K 396.0K12639 root sh /root/run.sh 0 120.0K 132.0K 400.0K12847 root sh /root/run.sh 0 120.0K 132.0K 400.0K13018 root sh /root/run.sh 0 120.0K 132.0K 400.0K13414 root sh /root/run.sh 0 120.0K 132.0K 400.0K14449 root sh /root/run.sh 0 120.0K 132.0K 400.0K14856 root sh /root/run.sh 0 120.0K 132.0K 400.0K15275 root sh /root/run.sh 0 120.0K 132.0K 400.0K17441 root sh /root/run.sh 0 120.0K 151.0K 512.0K18670 root sh /root/run.sh 0 120.0K 151.0K 512.0K19732 root sh /root/run.sh 0 120.0K 151.0K 512.0K22970 root sh /root/run.sh 0 120.0K 151.0K 512.0K849 root sh /root/run.sh 0 124.0K 155.0K 516.0K15471 root sh /root/run.sh 0 124.0K 136.0K 404.0K26613 root sh /root/run.sh 0 124.0K 155.0K 516.0K878 root /sbin/agetty --noclear tty1 0 132.0K 148.0K 808.0K8973 root sshd: dev [priv] 0 248.0K 1.6M 5.4M855 root /usr/sbin/irqbalance --fore 0 372.0K 399.0K 1.2M8985 dev sshd: dev@pts/0 0 412.0K 1.1M 2.6M828 root /sbin/auditd 0 528.0K 542.0K 1.0M8332 101 nginx: worker proces 0 560.0K 727.0K 2.1M8333 101 nginx: worker proces 0 560.0K 727.0K 2.1M8334 101 nginx: worker proces 0 560.0K 727.0K 2.1M8335 101 nginx: worker proces 0 560.0K 725.0K 2.1M880 chrony /usr/sbin/chronyd 0 636.0K 688.0K 1.7M871 root /usr/sbin/crond -n 0 728.0K 758.0K 1.7M8331 101 nginx: worker proces 0 760.0K 1.2M 3.6M852 dbus /usr/bin/dbus-daemon --syst 0 976.0K 1.1M 2.4M1500 postfix qmgr -l -t unix -u 0 1.0M 1.2M 2.9M1290 root /usr/sbin/sshd -D 0 1.1M 1.2M 3.0M859 root /usr/lib/systemd/systemd-lo 0 1.1M 1.1M 2.0M8330 101 nginx: worker proces 0 1.1M 1.6M 4.3M1488 root /usr/libexec/postfix/master 0 1.1M 1.1M 2.0M8328 101 nginx: worker proces 0 1.1M 1.7M 4.4M8986 dev -bash 0 1.2M 1.7M 2.9M16582 root -bash 0 1.3M 1.7M 2.9M20304 root /usr/bin/VGAuthService -s 0 1.4M 1.7M 3.6M856 root /usr/bin/abrt-watch-log -F 0 1.4M 1.6M 3.2M14964 postfix pickup -l -t unix -u 0 1.5M 1.8M 4.2M
,k参数用来显示内存单位,s表示排序,uss表示对USS列进行排序。这样就输出了系统中所有进行占用的内存大小,非常清晰明白。
smem -p -s ussPID User Command Swap USS PSS RSS15061 root sh /root/run.sh N/A 0.00% 0.00% 0.00%15650 root sh /root/run.sh N/A 0.00% 0.00% 0.00%30284 root sh /root/run.sh N/A 0.00% 0.00% 0.00%12639 root sh /root/run.sh N/A 0.00% 0.00% 0.00%12847 root sh /root/run.sh N/A 0.00% 0.00% 0.00%13018 root sh /root/run.sh N/A 0.00% 0.00% 0.00%13414 root sh /root/run.sh N/A 0.00% 0.00% 0.00%14449 root sh /root/run.sh N/A 0.00% 0.00% 0.00%14856 root sh /root/run.sh N/A 0.00% 0.00% 0.00%15275 root sh /root/run.sh N/A 0.00% 0.00% 0.00%17441 root sh /root/run.sh N/A 0.00% 0.00% 0.00%18670 root sh /root/run.sh N/A 0.00% 0.00% 0.00%19732 root sh /root/run.sh N/A 0.00% 0.00% 0.00%22970 root sh /root/run.sh N/A 0.00% 0.00% 0.00%849 root sh /root/run.sh N/A 0.00% 0.00% 0.00%15471 root sh /root/run.sh N/A 0.00% 0.00% 0.00%26613 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
,p表示以百分比的形式报告内存使用情况
smem -u -k
User Count Swap USS PSS RSS
chrony 1 0 636.0K 688.0K 1.7M
dbus 1 0 976.0K 1.1M 2.4M
dev 2 0 1.7M 2.8M 5.5M
postfix 2 0 2.5M 3.1M 7.1M
polkitd 1 0 9.2M 9.6M 11.5M
101 8 0 6.8M 9.7M 25.7M
mysql 1 0 264.0M 264.0M 265.1M
mongod 1 0 756.0M 756.1M 757.2M
root 133 0 15.0G 15.0G 15.4G
,u用来显示用户占用内存信息
smem -k -P nginx
PID User Command Swap USS PSS RSS
8335 101 nginx: worker proces 0 560.0K 725.0K 2.1M
8332 101 nginx: worker proces 0 560.0K 727.0K 2.1M
8333 101 nginx: worker proces 0 560.0K 727.0K 2.1M
8334 101 nginx: worker proces 0 560.0K 727.0K 2.1M
8331 101 nginx: worker proces 0 760.0K 1.2M 3.6M
8330 101 nginx: worker proces 0 1.1M 1.6M 4.3M
8328 101 nginx: worker proces 0 1.1M 1.7M 4.4M
8329 101 nginx: worker proces 0 1.7M 2.3M 5.0M
8227 root nginx: master process nginx 0 2.1M 2.4M 4.6M
20118 root python /usr/bin/smem -k -P 0 5.5M 5.7M 6.7M
