Top Linux real-time monitoring command to view CPU usage

Source: Internet
Author: User
Tags superuser permission

SELF: http://blog.csdn.net/zhangm168/article/details/6395689

I TopIs a dynamic display process, that is, you can press the key to constantly 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.

Note:The process information area is shown below the overall information of the statistical system for the first five lines.

1. The first line is the same as uptime, which isCurrent Time system running time 3 days Currently logged on to 1 userSystem LoadLoad average:, That is, the average length of the task queue

2. Information about the process and CPU. When multiple CPUs exist, the content may exceed two lines.
Tasks: 96 total process count
1. Number of Running Processes of Running
95 sleeping sleep Processes
0 stopped process count
0 zombie botnets

CPU (s): 0.0% us user space usage CPU percentage view CPU usage
1.0% Sy CPU usage in kernel space
0.0% percentage of CPU used by processes that have changed their priorities in Ni user process space
100.0% ID idle CPU percentage
0.0% wa CPU time percentage waiting for Input and Output
0.0% hi
0.0% Si
0.0% St

3. Last two behaviors: memory information
Mem: 506708 k total physical memory
Total physical memory used by 477080 K used
29628 K free Free Memory Total
Memory usage of 113736 K buffers as kernel Cache
Swap: 1015800 k total number of swap Areas
112 used the total number of swap zones used
1015688 K free swap zone total
169384 K cached buffer swap zone total
The content in the memory is swapped out to the swap zone and then into the memory, but the used swap zone has not been overwritten,
The value isThe content already exists in the memory.The size of the swap area.
When the corresponding memory is swapped out again, you do not have to write data to the swap zone.

4. Process Information area
PID process ID ppid parent process ID
PR priority
Negative Ni nice value indicates high priority, positive value indicates low priority
Total virtual memory used by the virt process, in KB. Virt = swap + Res
The size of the physical memory used by the res process, Not swapped out, in KB. Res = code + Data
Size of SHR shared memory, in KB
S Process statusD= Uninterrupted sleepR= RunS= SleepT= Trail/stopZ= Zombie Process
% Percentage of CPU time used since the last CPU update to the present
% Mem Process UsedPhysical memoryPercentage
Time + total CPU time used by the process, in the unit of 1/100 seconds
Command command name/command line
2. By default, only important PID, user, PR, Ni, virt, res, SHR, S, % CPU, % MEM, time +, and command columns are displayed. You can use the shortcut keys below to change the display content.
1 passFKey to select the displayed content. Press F to display the column list, press a-Z to display or hide the corresponding column, and then press enter to confirm

2 PressOThe key can change the Column Display sequence. A lower-case a-Z can move the corresponding column to the right, while an upper-case A-Z can move the corresponding column to the left. Press enter.

3. uppercaseFOrOAnd then press a-Z to sort the process by the corresponding column. In upper caseRThe key can reverse the current sorting.

4. Use parameters:
D. Specify the interval between two screen information refreshes. Of course, you can use the S interactive command to change it.
P only monitors the status of a process by specifying the monitoring process ID.
Q This option will refresh top without any delay. If the caller has the superuser permission, top runs with the highest possible priority.
S indicates the accumulative mode.
S enables the TOP command to run in safe mode. This removes the potential danger of interactive commands.
I so that top does not show any idle or dead processes.
C. display the entire command line, not just the command name.
5. Interactive commands used in top mode:
CTRL + LErase and override the screen.
 H or?The help screen is displayed, and some brief command summary is provided.
  KTerminate 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.
  IIgnore idle and dead processes. This is a switch-on command.
  QExit the program.
  RReschedule 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.
  SSwitch to the accumulative mode.
  SChanges the latency 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 m s. 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 or FAdd or delete a project from the current display.
  O or OChange the order of projects displayed.
  LSwitch to display the average load and start time information.
  MSwitch to Display memory information.
  TSwitch to display the process and CPU status information.
  CSwitch the display command name and the complete command line.
  MSort by resident memory size.
  PSort by CPU usage percentage.
  TSort by time/accumulative time.
WWrite the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files.

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.