How to use the top command to monitor Linux system performance

  
                

The top command can be used to monitor the performance of Linux systems. In fact, there are many commands for monitoring system performance in Linux. (See the system home to monitor the performance of Linux system?) The top command is just one of them. The home will give you a detailed introduction to the usage of the top command, let's get to know it.

top is a dynamic display process that allows the user to press the button to constantly refresh the current state. If the command is executed in the foreground, it will monopolize the foreground until the user terminates the program. More accurately, the top command provides real-time status monitoring of the system processor. It will display the list of tasks that are most CPU-sensitive in the system. This command can be used by the CPU. The memory usage and execution time sort the tasks; and many of the features of the command can be set via interactive commands or in a personal customization file.

1. Command format:

top [parameters]

2. Command Function:

Displays information about the process currently being executed by the system, including process ID, memory usage, CPU usage, etc.

3. Command parameters:

-b Batch

-c Display complete governance command

-I Ignore invalidation procedure

-s privacy mode

-S Cumulative mode

-i "Time" Set interval time

-u "user name" Specify user name

-p "process number" Specify process

-n "Number of times" The number of times the loop is displayed

4. Example:

Example 1: Displaying process information

Command: top

Output:

The code is as follows:

[root@ TG1704 log]# top

top - 14:06:23 up 70 days, 16:44, 2 users, load average: 1.25, 1.32, 1.35

Tasks: 206 total, 1 running , 205 sleeping, 0 stopped, 0 zombie

Cpu(s): 5.9%us, 3.4%sy, 0.0%ni, 90.4%id, 0.0%wa, 0.0%hi, 0.2%si, 0.0% St

Mem: 32949016k total, 14411180k used, 18537836k free, 169884k buffers

Swap: 32764556k total, 0k used, 32764556k free, 3612636k cached/p "p" PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

28894 root 22 0 1501m 405m 10m S 52.2 1.3 2534:16 java

18249 root 18 0 3201m 1.9g 11m S 35.9 6.0 569:39.41 Java

2808 root 25 0 3333m 1.0g 11m S 24.3 3.1 526:51.85 java

25668 root 23 0 3180m 704m 11m S 14.0 2.2 360:44.53 java

574 root 25 0 3168m 611m 10m S 12.6 1.9 556:59.63 java

1599 root 20 0 3237m 1.9g 11m S 12.3 6.2 262:01.14 java

1008 root 21 0 3147m 842m 10m S 0.3 2.6 4:31.08 java

13823 root 23 0 3031m 2.1g 10m S 0.3 6.8 176:57.34 java

28218 root 15 0 12760 1168 808 R 0.3 0.0 0:01.43 top

29062 root 20 0 1241m 227m 10m S 0.3 0.7 2:07.32 java

1 root 15 0 10368 684 572 S 0.0 0.0 1:30.85 init

2 root RT -5 0 0 0 S 0.0 0.0 0:01.01 migration/0

3 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0

4 root RT -5 0 0 0 S 0.0 0.0 0: 00.00 watchdog/0

5 root RT -5 0 0 0 S 0.0 0.0 0:00.80 migration/1

6 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/1< Br>

7 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/1

8 root RT -5 0 0 0 S 0.0 0.0 0:20.59 migration/2

9 root 34 19 0 0 0 S 0.0 0.0 0:00.09 ksoftirqd/2

10 root RT -5 0 0 0 S 0.0 0.0 0:00.00 Watchdog/2

11 root RT -5 0 0 0 S 0.0 0.0 0:23.66 migration/3

12 root 34 19 0 0 0 S 0.0 0.0 0:00.03 ksoftirqd/3

13 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/3

14 root RT -5 0 0 0 S 0.0 0.0 0:20.29 migration/4

15 root 34 19 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/4

16 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/4

17 root RT -5 0 0 0 S 0.0 0.0 0:23.07 migration/5

18 root 34 19 0 0 0 S 0.0 0.0 0:00.07 ksoftirqd/5

19 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/5

20 root RT -5 0 0 0 S 0.0 0.0 0:17.16 migration/6

21 root 34 19 0 0 0 S 0.0 0.0 0:00.05 ksoftirqd /6

22 root RT -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/6

23 root RT -5 0 0 0 S 0.0 0.0 0:58.28 migration/7
Previous12345Next page Total 5 pages

Copyright © Windows knowledge All Rights Reserved