Linux top, linux

Source: Internet
Author: User

Linux top, linux

Linux top commands

Enter top in the terminal and the result is as follows:

1: first line, system status

19:12:02 ----> current system time

6 min -------> the system has been started for 6 minutes.

1 use -------> only one user logs on. If two users log on to one account through two computers, the number is 2, that is, the number of logon attempts is not the number of accounts.

Load average: 0.43, 0.59, 0.3 -------> the three numbers represent the load Status of the system for 1 minute, 5 minutes, and 15 minutes, the three numbers check the number of active processes every five seconds, and then calculate the number of active processes based on a certain algorithm.

Command to view the number of CPUs, grep "model name"/proc/cpuinfo | wc-l

Assume that A = (load average), B = number of CPUs

A/B <0.7, indicating that the system is good

A/B> = 0.7 and A/B <= 1. If this is the case for A long time, it is best to check the server status as soon as possible to avoid load.

A/B> = 1 and A/B <= 5. The system is under load. Check the server status immediately.

A/B> 5. The system is overloaded.

2: The second line shows the process status.

Tasks: 198 total --------> the current system has a total of 198 processes.

2 running -------------> two processes are running.

196 sleeping ------------> 196 of the processes are in sleep state.

0 stopped ---------------> 0 of the processes are in the paused state.

0 zombie ----------------> 0 of the processes are in zombie state.

3: The third line shows the CPU status.

7.1 us --------> User CPU time: Percentage of CPU occupied by User space

5.9 sy --------> System CPU time: Percentage of CPU occupied by kernel space

0.0 ni --------> Percentage of CPU used by Nice CPU time that has changed the priority of processes

86.7 id -------> Percentage of idle CPU

0.2 wa --------> iowait: Percentage of CPU occupied by I/O wait

0.1 hi --------> Hardware IRQ: Percentage of hard interrupt CPU usage

0.0 si --------> SoftwareIRQ: Percentage of CPU used by Soft Interrupt

0.0 st --------> Steal Time: percentage of Time the virtual CPU waits for the physical CPU

4: Row 4: memory status

3931300 total ------> total memory (4 GB)

1402100 used --------> total memory used (1.4 GB)

2529200 free --------> total idle memory (2.5 GB)

89240 buffers ------> cache memory (89 MB)

5: the fifth line, the status of the swap area

7812092 total -------> the total number of swap areas (8 GB). At that time, the partition was manually divided into two times of memory, 8 GB

0used ---------------> the total number of swap areas used (0). 0 M is used, indicating that the physical memory is sufficient for the moment.

7812092 free --------> total number of free swap areas (8 GB)

689192cached --------> total buffer swap zone (7 GB)

6: the sixth line shows the status of each process.

PID ---------> process ID

USER --------> process owner

PR ----------> process priority, which is the priority assigned by the kernel, generally 20 higher than the NI value.

If it is rt (real time), it indicates that the process runs at the real-time scheduling priority.

NI ----------> nice value. Is the user-level priority. The smaller the priority, the higher the priority.

VIRT --------> total memory required by a process, including the database, code, and data used by the process, in kb.

If the process requests 5 MB of memory but only uses 1 MB, it will increase by 5 MB instead of the actual usage.

RES ---------> the size of the physical memory currently used by the process, not swapped out, in kb.

If the process requests 5 MB of memory but only uses 1 MB, it will increase by 1 MB, which is the actual usage.

SHR ---------> shared memory size, in kb

S -----------> Process status. D = an uninterrupted sleep state. In this state, kill the process is difficult.

For example, this is the status when the read system is called, but the top command cannot be captured because the time is too short.

S = interruptible sleep state R = running T = tracking/stopping Z = botnets

% CPU --------> Percentage of CPU usage since the last update

% MEM --------> Percentage of physical memory used by the Process

TIME + -------> total cpu time used by the process, in the unit of 1/100 seconds

COMMAND -----> process name

How can I explain the top commands of common analysis tools in Linux?

The top command is a common performance analysis tool in Linux. It can display the resource usage of various processes in the system in real time, similar to the Windows Task Manager. The following describes how to use it.

Top-01:06:48 up, 1 user, load average: 0.06, 0.60, 0.48

Tasks: 29 total, 1 running, 28 sleeping, 0 stopped, 0 zombie

Cpu (s): 0.3% us, 1.0% sy, 0.0% ni, 98.7% id, 0.0% wa, 0.0% hi, 0.0% si

Mem: 191272 k total, 173656 k used, 17616 k free, 22052 k buffers

Swap: 192772 k total, 0 k used, 192772 k free, 123988 k cached

Pid user pr ni virt res shr s % CPU % mem time + COMMAND

1379 root 16 0 7976 2456 S 1980 0.7. 03 sshd

14704 root 16 0 2128 980 R 796 0.7. 72 top

1 root 16 0 1992 632 S 544 0.0. 90 init

2 root 34 19 0 0 S 0.0 0.0. 00 ksoftirqd/0

3 root RT 0 0 0 S 0.0 0.0. 00 watchdog/0

The first five lines in the statistical information area are the overall statistical information of the system. The first line is the task queue information, which is the same as the execution result of the uptime command. The content is as follows:

01:06:48 current time

Up system running time, format: minute

1 user current Login user count

Load average: 0.06, 0.60, 0.48 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.

Second and Third, information about the process and CPU. When multiple CPUs exist, the content may exceed two rows. The content is as follows:

Tasks: 29 total process count

1. Number of running Processes of running

28 sleeping sleep Processes

0 stopped process count

0 zombie botnets

Cpu (s): 0.3% us 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

98.7% id idle CPU percentage

0.0% wa CPU time percentage waiting for Input and Output

0.0% hi

0.0% si

Memory information of the last two behaviors. The content is as follows:

Mem: 191272 k total physical memory

Total physical memory used by 173656 k used

17616 k free Memory Total

Memory usage of 22052 k buffers as kernel Cache

Swap: 192772 k total number of Swap Areas

Total number of swap areas used by 0 k used

192772 k free swap zone total

The total number of swap areas of the 123988 k cached buffer.

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,

This value indicates the size of the SWAp zone in which the content already exists.

In the Linux top Command, % CPU results are higher than % us. Why?

Us is user
Sy is system
Note that % wa and waiting are the IO time. Generally, they are waiting for disk operations.

100%-% id (idle) is the total CPU usage time.

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: 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.