Linux top command and linuxtop command

Source: Internet
Author: User
Tags high cpu usage

Linux top command and linuxtop command

I. Introduction

TOP is a dynamic display process. You can press the buttons to refresh the current status. if you execute this command on the foreground, it excludes the foreground until the user terminates the program. more accurately, the top command provides real-time monitoring of the status of the system processor. it displays the list of CPU-sensitive tasks in the system. this command can be used by CPU. the memory usage and execution time are used to sort tasks. Many features of this command can be set through interactive commands or in a custom file.

 

Ii. Common commands

H or? : Displays the help screen and provides some brief command summary. K: terminate a process. The system prompts the user to enter the PID of the process to be terminated and the signal to be sent to the process. Generally, 15 signals can be used to terminate a process. If the process cannot end normally, use signal 9 to forcibly end the process. The default value is signal 15. This command is blocked in security mode. I: Ignore idle and dead processes. This is a switch-on command. Q: exit the program. R: reschedule the priority of a process. The system prompts the user to enter the process PID to be changed and the process priority value to be set. Entering a positive value will lower the priority, and vice versa will give the process a higher priority. The default value is 10. S: switch to the accumulative mode. S: Change the delay time between two refreshes. The system prompts the user to enter a new time in seconds. If there is a decimal number, it is converted to ms. If the input value is 0, the system will be refreshed continuously. The default value is 5 s. It should be noted that if the setting is too small, it is likely to cause constant refresh, so it is too late to see the display, and the system load will increase significantly. F/F: add or delete a project from the current display. O/O: Change the display project order. L: the average load and startup time are displayed during switchover. Display the first line of the Shadow m: Switch to display the memory information. Display shadow memory Line t: Switch to display process and CPU status information. Display the shadow CPU line c: Switch the display command name and the complete command line. The complete command is displayed. This function is useful. M: sort by resident memory size. P: sort by CPU usage percentage. T: sort by time/accumulative time. W: Write the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files.

 

Iii. Instances

1) Find the threads with high cpu usage:

ps H -eo user,pid,ppid,tid,time,%cpu,cmd --sort=%cpu

2) view the processes with the highest cpu usage

Top (then press M. Note that this is in uppercase) ps aux | head-1; ps aux | grep-v PID | sort-rn-k + 3 | head

3) view the process with the highest memory usage

Top (then press P. Note that this is in uppercase) ps aux | head-1; ps aux | grep-v PID | sort-rn-k + 4 | head

 

Reference: http://www.jb51.net/LINUXjishu/34604.html

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.