Use of top commands in CentOS

Source: Internet
Author: User
The first line of the top command, like the uptime Command, has a system load. 10:36:19 current time up1day, 7 min system running time, format: Minute 1 user current login user loadaverage: 0.00, 0.00, 0.00 system load, that is, the average length of the task queue. The three values are 1 minute respectively.

Top Command

 

The first line has the same system load as the uptime Command.

10:36:19 current time
Up 1 day, 7 min system running time, in the format of Day: Minute
1 user current login user count
Load average: 0.00, 0.00, 0.00 system load, that is, the average length of the task queue.
The three values are the average values from 1 minute, 5 minutes, and 15 minutes ago to the present.

 

The second line refers to the process status.

Tasks: 84 total process count
1. number of running processes of running
83 sleeping sleep processes
0 stopped process count
0 zombie botnets

 

The third line is the percentage of cpu in each status.

Us is user cpu time percentage sy is system cpu time percentage ni is elegant cpu time percentage id is cpu idle time percentage wa is I/O wait time percentage hi is hardware interrupt time percentage st is percentage of elapsed time (when a VM is running, percentage of time when other tasks are executed)

The idle time of the system depends on the number of CPUs and system load. For example, if the system load is 1.70 for four CPUs, the system has over 50% idle time.

Troubleshooting: When a system runs slowly, the first metric to be observed is the I/O wait time (wa), which can be used to eliminate disk I/O problems.

If the I/O wait time is low, you can view the percentage of CPU idle time (id ).

If the I/O wait time is high, the next step is to determine what causes the proportion of I/O wait time to be so high.

If the percentage of I/O waits and CPU idle time is low, a very high percentage of user time is likely to be seen, so you must determine what causes such a high percentage of user time.

If the percentage of I/O wait time is very low, and the percentage of idle time is very high, you will know that the system is not slow because of CPU resources, but you should find the reason elsewhere. (It may be a network problem, a web server problem, or a slow mysql Query ).

 

The fourth row is the memory usage.

Mem: 1922432 k total physical memory
Total physical memory used by 1825816 k used
96616 k free memory total
Memory usage of 36028 k buffers as Kernel Cache
 

The fifth line refers to the usage of swap.

Swap: 4194296 k total number of Swap areas
The total number of swap areas used by 152524 k used
4041772 k free swap zone total
The total number of swap areas of the 53564 k cached buffer.

 

If you want to kill a process, press K and enter the PID you want to terminate. when the system prompts that the process will terminate at signal 15, press Enter to kill the process.

Top Command

Top-B-n 1 where-B refers to enabling the batch processing mode (not very familiar, it feels like displaying all processes, unlike displaying only one page on top ), -n 1 indicates that the refresh count is 1. after the refresh is completed, the top

Top-B-n 1> top-out: redirects the output to the top-out file.

Top-B-n 1 | tee top-output is output to both the screen and the top-output file. (The tee command can be output to both the screen and the file)

Related Article

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.