Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Explain in detail how Linux looks at the processes that currently consume the most CPU or memory

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Command

Ps-aux | sort-k4nr | head-N

Detailed description of the command:

1. Head:-N can specify the number of rows to be displayed, and 10 rows are displayed by default.

2. Ps: parameter a refers to all processes in all--, u refers to the user id,x who executes the process in userid--, and shows all programs, not distinguished by terminals.

The output format of ps-aux is as follows:

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

3. In sort-k4nr (k stands for sorting by which keyword, the following number 4 indicates sorting by the fourth column; n refers to numberic sort, sorted according to its numerical value; r refers to reverse, which refers to the reverse comparison result, the output defaults from small to big, reverse from big to small. ). In this example, you can see that% MEM is in the fourth position, sorted from largest to smallest according to the value of% MEM. K3 indicates that it is sorted by cpu occupancy.

The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report