1. smem -k -s uss
    2. PID User Command Swap USS PSS RSS
    3. 15061 root sh /root/run.sh 0 116.0K 128.0K 396.0K
    4. 15650 root sh /root/run.sh 0 116.0K 128.0K 396.0K
    5. 30284 root sh /root/run.sh 0 116.0K 128.0K 396.0K
    6. 12639 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    7. 12847 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    8. 13018 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    9. 13414 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    10. 14449 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    11. 14856 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    12. 15275 root sh /root/run.sh 0 120.0K 132.0K 400.0K
    13. 17441 root sh /root/run.sh 0 120.0K 151.0K 512.0K
    14. 18670 root sh /root/run.sh 0 120.0K 151.0K 512.0K
    15. 19732 root sh /root/run.sh 0 120.0K 151.0K 512.0K
    16. 22970 root sh /root/run.sh 0 120.0K 151.0K 512.0K
    17. 849 root sh /root/run.sh 0 124.0K 155.0K 516.0K
    18. 15471 root sh /root/run.sh 0 124.0K 136.0K 404.0K
    19. 26613 root sh /root/run.sh 0 124.0K 155.0K 516.0K
    20. 878 root /sbin/agetty --noclear tty1 0 132.0K 148.0K 808.0K
    21. 8973 root sshd: dev [priv] 0 248.0K 1.6M 5.4M
    22. 855 root /usr/sbin/irqbalance --fore 0 372.0K 399.0K 1.2M
    23. 8985 dev sshd: dev@pts/0 0 412.0K 1.1M 2.6M
    24. 828 root /sbin/auditd 0 528.0K 542.0K 1.0M
    25. 8332 101 nginx: worker proces 0 560.0K 727.0K 2.1M
    26. 8333 101 nginx: worker proces 0 560.0K 727.0K 2.1M
    27. 8334 101 nginx: worker proces 0 560.0K 727.0K 2.1M
    28. 8335 101 nginx: worker proces 0 560.0K 725.0K 2.1M
    29. 880 chrony /usr/sbin/chronyd 0 636.0K 688.0K 1.7M
    30. 871 root /usr/sbin/crond -n 0 728.0K 758.0K 1.7M
    31. 8331 101 nginx: worker proces 0 760.0K 1.2M 3.6M
    32. 852 dbus /usr/bin/dbus-daemon --syst 0 976.0K 1.1M 2.4M
    33. 1500 postfix qmgr -l -t unix -u 0 1.0M 1.2M 2.9M
    34. 1290 root /usr/sbin/sshd -D 0 1.1M 1.2M 3.0M
    35. 859 root /usr/lib/systemd/systemd-lo 0 1.1M 1.1M 2.0M
    36. 8330 101 nginx: worker proces 0 1.1M 1.6M 4.3M
    37. 1488 root /usr/libexec/postfix/master 0 1.1M 1.1M 2.0M
    38. 8328 101 nginx: worker proces 0 1.1M 1.7M 4.4M
    39. 8986 dev -bash 0 1.2M 1.7M 2.9M
    40. 16582 root -bash 0 1.3M 1.7M 2.9M
    41. 20304 root /usr/bin/VGAuthService -s 0 1.4M 1.7M 3.6M
    42. 856 root /usr/bin/abrt-watch-log -F 0 1.4M 1.6M 3.2M
    43. 14964 postfix pickup -l -t unix -u 0 1.5M 1.8M 4.2M

    ,k参数用来显示内存单位,s表示排序,uss表示对USS列进行排序。这样就输出了系统中所有进行占用的内存大小,非常清晰明白。

    1. smem -p -s uss
    2. PID User Command Swap USS PSS RSS
    3. 15061 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    4. 15650 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    5. 30284 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    6. 12639 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    7. 12847 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    8. 13018 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    9. 13414 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    10. 14449 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    11. 14856 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    12. 15275 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    13. 17441 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    14. 18670 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    15. 19732 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    16. 22970 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    17. 849 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    18. 15471 root sh /root/run.sh N/A 0.00% 0.00% 0.00%
    19. 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