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

The usage of top instruction in Linux

2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "the usage of top instruction in Linux". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the usage of top instruction in Linux.

01

Top instruction

Enter the top view

01

First line

10:33:06-current system time

90 days, 20:05-the system has been running for 90 days, 20 hours and 5 minutes

2 users-there are currently 2 users logged in to the system

Load average: 0.00,0.03,0.07-load for 1, 5, 15 minutes. How to divide this number by the number of logical CPU, when the result is higher than 5, it indicates that the system is overloaded.

02

Second line

Tasks: 96 total, 1 running, 95 sleeping, 0 stopped, 0 zombie

The system now has 135 processes, of which 1 is running, 95 are dormant, 0 are stopped, and 0 are zombie

03

The third line

% Cpu (s): CPU status

1.3 us: percentage of cpu occupied by user space

1.3 sy: percentage of cpu occupied by kernel space

0.0 ni: percentage of cpu occupied by processes that have changed priority

97.3 id: percentage of idle cpu

0.0% of cpu occupied by wa:IO waiting

Percentage of CPU occupied by 0.0 hi,: hard interrupts

0.0 si: percentage of cpu occupied by soft interrupts

04

Fourth line

KiB Mem: memory statu

1883724 total: total physical memory (2GB)

490612 free: total free memory (49m)

804636 used: total memory in use (84m)

588476 buff/cache: amount of cached memory (58m)

05

The fifth line

Swap switching partition

4184924k total-Total switching area (4G)

0k used-Total number of swap areas used (0m)

4184924k free-Total free swap area (4G)

2483956k cached-Total number of swap areas buffered (2483m)

The total amount of memory in use (used) in the fourth line refers to the amount of memory currently controlled by the system kernel, and the total amount of free memory (free) is the amount that the kernel does not yet control. Not all the memory managed by the kernel is in use, and it also includes memory that has been used in the past and can be reused now, and the kernel does not return the reusable memory to free, so there will be less and less free memory on linux, but don't worry about it.

If you are used to calculating the amount of available memory, here is an approximate formula: free on the fourth line + buffers on the fourth line + cached on the fifth line. According to this formula, the available memory of this server: 148M+259M+2483M = 2990m.

For memory monitoring, we should always monitor the used of the fifth line of swap swap partition in top. If this value is constantly changing, it means that the kernel is constantly exchanging data between memory and swap, which is really out of memory.

06

The seventh line

Line 7 is as follows: status monitoring of each process (task)

PID-process id

USER-process owner

PR-process priority

NI-nice value. Negative values indicate high priority, while positive values indicate low priority.

VIRT-the total amount of virtual memory used by the process, in kb. VIRT=SWAP+RES

RES-the amount of physical memory used by the process that has not been swapped out, in kb. RES=CODE+DATA

SHR-shared memory size in kb

S-process status. D = uninterruptible sleep state R = run S = sleep T = track / stop Z = zombie process

% CPU-percentage of CPU time elapsed since last update

% MEM-percentage of physical memory used by the process

Total TIME+-the total CPU time used by the process, in 100 seconds

COMMAND-process name (command name / command line)

Thank you for reading, the above is the content of "usage of top instruction in Linux". After the study of this article, I believe you have a deeper understanding of the usage of top instruction in Linux, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report