Linux memory usage command

Source: Internet
Author: User


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"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.