How Linux looks at the number of processes currently consuming CPU or memory

Source: Internet
Author: User

1. PS command
-aux | sort -k4nr | head -N
    • 1

* Detailed command:
1. head :-n can specify the number of rows to display, and 10 rows by default.
2. ps : Parameter a refers to all processes of all--, u refers to userid--executing the process of the user id,x refers to display all programs, do not differentiate by terminal. The output format of the Ps-aux is as follows:

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMANDroot         1  0.0  0.0  19352  1308 ?        Ss   Jul29   0:00 /sbin/initroot         2  0.0  0.0      0     0 ?        S    Jul29   0:00 [kthreadd]root         3  0.0  0.0      0     0 ?        S    Jul29   0:11 [migration/0]
    • 1
    • 2
    • 3
    • 4
    • 5

3. SORT-K4NR (k represents the sort from which keyword, followed by the number 4 is sorted according to the fourth column; n refers to numberic sort, according to its numerical order; R refers to the reverse, here refers to the reverse comparison results, the output by default from small to large, backward from large to small. )。 In this example, you can see%mem in the 4th position, based on the value of%mem, from the large to the small sort. -K3 is sorted by CPU utilization.

How Linux looks at the number of processes currently consuming CPU or memory

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.