Graphical use of the top command in Linux

Source: Internet
Author: User

The top command is often used to monitor Linux system conditions, such as CPU, memory usage, the programmer basically knows this command, but it is strange to use it very few people, such as the top monitoring view of the memory value of the meaning of a lot of distortion. This article covers the meaning of various data in the top view and the sorting of the fields of each process (task) in the view through top monitoring of a running Web server. Top into view top view 01 "Top View 01" is the basic view that just entered top, and let's combine this view to explain the meaning of each data.
First line:
10:01:23 Current system time
126 days, 14:29 the system has been running for 126 day, 14 hours, 29 minutes (not restarted during this period)
2 users currently have 2 user login systems
The three numbers behind load average:1.15, 1.42, 1.44 load average are 1-minute, 5-minute, 15-minute loads respectively. The load average data is the number of active processes that are checked every 5 seconds and then calculated by a particular algorithm. If this number is divided by the number of logical CPUs, the result above 5 indicates that the system is overloaded.Second line:
tasks Task (process), the system now has a total of 183 processes, of which there are 1 in the running, 182 in hibernation (sleep), 0 in the stoped state, and 0 in the zombie State (zombie). Third line: CPU status
6.7% the percentage of CPU occupied by US user space.
0.4% Sy Core Space consumes a percentage of the CPU.
0.0% NI changes the priority of the process to occupy a percentage of the CPU
92.9% ID Idle CPU percent
0.0% wa io waiting for CPU percentage
0.0% Hi Hard Interrupt (Hardware IRQ)% of CPU occupied
0.0% si soft interrupt (software interrupts) consumes CPU percentage here the CPU usage ratio differs from the Windows conceptThe Linux system divides itself into two parts, part of the core software, which is kernel, also known asKernel space, and the other part is normalApplication, this part is called User space. Line four: Memory status
8306544k Total Physical Memory (8GB)
7775876k used total memory in use (7.7GB)
530668k free Memory Total (530M)
79236k Buffers Cache Memory (79M)
Line five: Swap swap partition
2031608k Total swap area (2GB)
Total swap area used by 2556k used (2.5M)
2029052k Free Swap Area total (2GB)
4231276k Cached Buffer Total (4GB) Total amount of memory in use in line fourth (used) refers to the amount of memory that is now controlled by the system kernel, and the total amount of free memory that the kernel has not included in its control range. The memory that is included in kernel management is not always in use, but also includes the memory that has been used in the past that can now be reused, and the kernel does not return these reusable memory to free, so there is less memory on Linux, but don't worry about it. If you are accustomed to calculating the number of available memory, here is an approximate formula: The fourth line of Free + fourth row of buffers + fifth row of cached, press this formula for this server's available memory: 530668+79236+4231276 = 4.7GB.
For memory monitoring, in the top we have to monitor the fifth line swap partition used, if this value is constantly changing, indicating that the kernel is constantly in memory and swap data exchange, which is really not enough memory. Line six is the empty line below line seventh: status monitoring of each process (Task)
PID Process ID
USER Process Owner
PR Process Priority
NI nice value. Negative values indicate high priority, positive values indicate low priority
The total amount of virtual memory used by the VIRT process, in kilobytes. Virt=swap+res
The size, in kilobytes, of the physical memory used by the RES process and not swapped out. Res=code+data
SHR shared memory size, in kilobytes
S process state. d= non-disruptive sleep status r= run s= sleep t= track/stop z= zombie Process
%cpu percentage of CPU time that was last updated to current

Percentage of physical memory used by the%MEM process
Total CPU time used by the time+ process, Unit 1/100 sec
Commands process name (command name/command line) Multi-u multi-core CPU monitoring in the top basic view, press the keypad number 1 to monitor the status of each logical CPU: Top View 02 observes that the server has 16 logical CPUs and is actually 4 physical CPUs. Process field sorting default to top, each process is sorted by CPU consumption, in "Top View 01" In the process ID 14210 of the Java process ranked first (CPU occupied 100%), the process ID of 14183 Java process ranked second (CPU occupied 12%). You can change the sort field by keyboard instruction, for example, to monitor which process consumes mem most, I use the following method as follows: 1. Tap Keyboard B (turn on/off highlighting) and the top view changes as follows: Top view 03 We found that the top process with process ID 10704 is highlighted, and the top process is the only running state (runing) that is displayed in the second row of the view. You can turn off or turn on the highlight effect of a running process by tapping the Y key. 2. Tap keyboard x (Highlight effect on/off column), and the top view changes as follows:
Top View 04 You can see that the top default sort column is%cpu.  3. With SHIFT + > or SHIFT + < You can change the sort order to the right or left by pressing SHIFT + >: Top view 05 View is now sorted by%mem. Change the process display field  4. Hit the F key and top into another view, where you can orchestrate the display fields in the base view:  op View 06 This lists all the process fields that can be displayed in the top basic view, with * and the fields marked as uppercase are visible, and fields without * and lowercase letters are not displayed. If you want to display the code and data two fields in the basic view, you can 07 5 by tapping the R and S keys: Top view. Return to Basic view, you can see more code and data two fields:  reprint: http://www.2cto.com/os/201209/157960.html

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.