Linux bottom top command parameter dictionary

Source: Internet
Author: User
Tags current time memory usage safe mode sleep sorts terminates time interval cpu usage

The top command is a commonly used performance analysis tool under Linux to display the resource consumption status of each process in real time, similar to the Task Manager of Windows. The following is a detailed description of how it is used.

The code is as follows Copy Code
top–01:06:48 up 1:22, 1 user, load average:0.06, 0.60, 0.48
tasks:29 Total, 1 running, 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:191272k Total, 173656k used, 17616k free, 22052k buffers
swap:192772k Total, 0k used, 192772k free, 123988k cachedpid USER PR NI virt RES SHR S%cpu%mem Time+ COMMAND
1379 Root 0 7976 2456 1980 S 0.7 1.3 0:11.03 sshd
14704 Root 0 2128 796 R 0.7 0.5 0:02.72 Top
1 Root 0 1992 632 544 S 0.0 0.3 0:00.90 Init
2 Root 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0

Statistical information Area

The first five elements are the statistical information of the system as a whole. The first line is the task queue information, with the execution result of the uptime command. Its contents are as follows:

01:06:48 Current Time
Up 1:22 system run time, format last: Min
1 User Current Logged-in users
Load average:0.06, 0.60, 0.48 system load, that is, the average length of the task queue.
Three values are 1 minutes, 5 minutes, and 15 minutes ago to the current average.

The second to third behavior process and CPU information. When you have more than one CPU, the content can be more than two lines. The contents are as follows:

Total Process tasks:29
1 running number of processes running
Number of sleeping sleep processes
0 stopped number of processes stopped
0 Zombie Zombie Process number
CPU (s): 0.3% US user space uses CPU percent
1.0% sy kernel space occupies CPU percent
0.0% ni% of processes in user process space that have changed priority
98.7% ID Idle CPU percent
0.0% wa% CPU time waiting for input output
0.0% hi
0.0% si

The last two acts of memory information. The contents are as follows:

Total physical memory of mem:191272k
Total physical memory used by 173656k used
17616k free Memory Total
22052k buffers as the kernel cache memory
Total Exchange area of swap:192772k
Total number of swap areas used by 0k used
192772K free Idle swap area total
123988k cached the total number of swap areas buffered.
The content in memory is swapped out to the swap area and then swapped into memory, but the used swap area has not been overwritten,
The value is the size of the swap area where the content already exists in memory.
When the corresponding memory is swapped out again, you do not have to write to the swap area again.

Process Information Area

The details of each process are shown below the statistical information area. First of all, to understand the meaning of the columns.

Ordinal column name meaning
A PID process ID
b PPID Parent Process ID
C Ruser Real user name
D UID Process Owner's user ID
The user name of the e user process owner
Group name of the F group Process owner
G TTY starts the process's terminal name. Processes that are not started from the terminal are displayed as?
H-PR Priority
I NI nice value. A negative value indicates a high priority, and a positive value indicates a low priority
The last CPU used by J P is meaningful only in a multi-CPU environment
K%cpu percentage of CPU time last updated to now
The total amount of CPU time used by the L/O process, in seconds
Total CPU time used by the M time+ process, in units 1/100 seconds
N%mem percent of physical memory used by the process
o The total amount of virtual memory used by the virt process, in kilobytes. Virt=swap+res
The amount of virtual memory that the P swap process uses, the size of which is swapped out, the unit KB.
The amount of physical memory used by the Q RES process that is not swapped out, in kilobytes. Res=code+data
The physical memory size, in kilobytes, that the code executable uses
The amount of physical memory (data segment + stack) occupied by parts other than the S data executable code, in kilobytes
T SHR shared memory size, per kb
U Nflt page Error times
V NDRT last written to now, the number of pages that have been modified.
W S process status.
D= an uninterrupted sleep state
R= Run
S= Sleep
t= Tracking/Stopping
z= Zombie Process
x command name/command line
Y Wchan If the process is sleeping, show the name of the system function in sleep
Z Flags task flags, reference sched.h

By default, only the more important PID, USER, PR, NI, Virt, RES, SHR, S,%cpu,%mem, time+, COMMAND columns are displayed. You can change the display by using the shortcut keys below.

Change what's displayed

The F key allows you to select what to display. Press the F key to display a list of columns, A-Z to show or hide the corresponding columns, and then press ENTER to determine.

Press the O key to change the order in which the columns are displayed. A A-Z in lowercase can move the corresponding column to the right, while an uppercase A-Z moves the corresponding column to the left. Finally press ENTER to determine.

Press the F or O key in uppercase, and then press A-Z to sort the process by the appropriate column. The uppercase R key can reverse the current sort.

command to use

1. Tool (command) name
Top
2. Tool (command) function
Displays the current process and other conditions of the system; Top is a dynamic display process that refreshes the current state with user keystrokes. If you execute the command at the foreground, it will monopolize the foreground until the user terminates the program. More precisely, the top command provides real-time state monitoring of the system's processors. It will show the CPU most "sensitive" in the system Task List. This command can be used by the CPU. Memory usage and execution times are used to sort tasks, and many of the commands can be set through interactive commands or in personal custom files.
3. Environment settings
Used under Linux.
4. How to use
4. 1 Use Format
Top [-] [d] [P] [Q] [C] [C] [s] [s] [n]
4. 2 parameter description
d Specifies the time interval between refresh of the screen information every two times. Of course, users can use the s interactive command to change it.
P monitors only the state of a process by specifying the monitoring process ID.
Q This option will cause top to be refreshed without any delay. If the calling program has Superuser privileges, top will run at the highest possible priority level.
S Specifies the cumulative mode
s makes the top command run in Safe mode. This removes the potential risk of interaction commands.
I make top do not show any idle or zombie processes.
C Displays the entire command line instead of just displaying the command name
4.3 Other
The following are some of the interaction commands that you can use during the top command execution. From a usage point of view, mastering these commands is more important than mastering the options. These commands are all single letters, and if the S option is used in command-line options, some of these commands may be blocked.
Ctrl+l Erase and rewrite the screen.
H or? Displays the help screen, giving some brief summary instructions.
K Terminates a process. The user is prompted to enter the process PID that needs to be terminated, and what signal needs to be sent to the process. The general termination process can use 15 signals, and if not, use signal 9 to force the end of the process. The default value is signal 15. This command is blocked in safe mode.
I ignore idle and zombie processes. This is a switch command.
Q quit the program.
R to reschedule a process's priority level. The system prompts the user to enter the process PID to be changed and the process priority value that needs to be set. Entering a positive value causes the priority to be lowered, whereas the process can have a higher priority. The default value is 10.
S switch to cumulative mode.
s changes the delay time between two times of refresh. The user will be prompted to enter a new time in the unit S. If there is a decimal number, it is converted to M S. Enter a value of 0 and the system will refresh continuously with the default value of 5 S. It is important to note that if the setting is too small, it is likely to cause a constant refresh, so it is too late to see the display of the situation, and the system load will be greatly increased.
F or F to add or remove items from the current display.
O or O change the order in which items are displayed.
L Toggle Display Average load and start time information.
M toggles the display of memory information.
T toggles the display of process and CPU state information.
C Toggles the display of the command name and the full command line.
M sorts based on the size of the resident memory.
P is sorted according to the percentage size used by the CPU.
T sorts according to time/cumulative time.
W writes the current settings to the ~/.TOPRC file. This is the recommended method for writing the top configuration file.

Top Command View CPU usage


Action Example:

Enter top on the command line

You can start top

Top Full Screen Dialog mode can be divided into 3 parts: System Information Bar, command input bar, process list bar.

The first part--The top System Information Bar:

First line (top):

"00:11:04" is the current moment of the system;

"3:35" to the current operating time after the system is started;

"2 Users" is the user who is currently logged on to the system, or, more specifically, the number of terminals to which the user is logged on--the connection to multiple terminals of the system at the same time as a user will be treated as multiple users connected to the system,

The number of users will also appear as the number of terminals;

"Load average" is the average of the current system load, followed by three values of 1 minutes ago, 5 minutes ago, 15 minutes before the average of the process, you can generally think that the number is more than the CPU

When the CPU will be more laborious load the current system contains the process;

Second line (Tasks):

"Total" is the current number of system processes;

"1 Running" is the number of processes currently running;

"Sleeping" is the number of processes currently in the waiting state;

"0 stoped" is the number of system processes stopped;

"0 Zombie" for the number of recovered processes;

Third line (Cpus):

The current utilization rate of CPU is indicated respectively.

Line Four (MEM):

Represents the total amount of memory, current usage, amount of idle memory, and the amount of RAM used in the buffer;

Line Five (Swap):

Represents a category with line fourth (MEM), but this reflects the usage of swap partitions (swap). Typically, swap partitions (swap) are used frequently, and are considered to be the result of insufficient physical memory.

  

Part Two--internal command prompt bar in the middle section:

The top command allows you to control how the process is displayed through the top's internal commands. The internal command follows the following table:

S-Change the frequency of the screen update

L-The representation of the first line top information on the first section is closed or opened

T-closes or opens the first part the second line of Tasks and third line Cpus information representation

M-to close or open the first section the representation of the four-line Mem and fifth-line Swap information

N-Arranges the list of processes in the order of the PID size (Part III)

P-Arranges the list of processes in the order of CPU usage (Part III)

M-Arranges the list of processes in the Order of Memory occupancy (Part III)

H-Show help

N-Sets the number of processes displayed in the process list

Q-Exit Top

S-Change the screen update cycle

Part three--The process list bar in the bottom section:

The PID-Differentiated process list updates periodically according to the set of screens. The top internal command controls how the display is displayed here.

 

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.