Linux memory usage view command view memory: free www.2cto.com total used free shared buffers cachedMem: 8126976 7609376 517600 0 447392 1268632-/+ buffers/cache: 5893352 2233624 Swap: 2928636 572388 2356248 top view process, shift + f can set the sorting order. If you sort by RES, you can ensure that you can clearly view the threads that occupy a large amount of memory. Www.2cto.com ps: view the process. Generally, use ps-ef, ps-aux-A: all processes are displayed, which has the same effect as-e;-: all processes not related to terminal;-u: processes related to valid users; x: usually used together with the parameter a to list more complete information. Output format planning: l: list the PID information in a long and detailed manner; j: Job format-f: make a more complete output. Red is the parent process idguest 12032 11991 0 00:00:00 pts/0 grep httpdadmin 14969 26047 0? 00:00:01/usr/alibaba/httpd/bin/httpd-d/home/admin/run/deployadmin 20417 26047 0? 00:00:01/usr/alibaba/httpd/bin/httpd-d/home/admin/run/deployroot 26047 1 0 Nov19? 00:00:00/usr/alibaba/httpd/bin/httpd-d/home/admin/run/deploy through pstree-p 26047, you can see all the sub-process threads! View swap usage :#! /Bin/bashPID =$ {1:-[1-9] *} total_swap = 0 GetSwap () {pid = $1 pipeline line = $ (cat/proc/$ pid/pipeline line 2>/dev/null | tr '''') pid_swap = $ (awk 'in in {total = 0}/Swap/{total + = $2} END {print total} '/proc/$ pid/smaps 2>/dev/ null) if ["$ pid_swap "! = ''] & [" $ Pid_swap "-gt 0]; then echo" PID = $ pid-Swap used: $ pid_swap Kb-($ queue line) "fi} cd/procfor pid in $ PID; do GetSwap $ pid let total_swap + = $ pid_swapdoneecho" Total swap: $ total_swap Kb"