Linux top commands

Source: Internet
Author: User
Tags superuser permission

 

 

The top command is used to display the current process and other conditions of the system. It is a dynamic display process, that is, you can press the key to continuously refresh the current status, if the command is executed on the foreground, the foreground is exclusive. Until the user terminates the program. To be more accurate, the top command provides real-time monitoring of the status of the system processor. It displays the list of CPU-sensitive tasks. This command can be used by CPU, rough inside, and sorted by execution time. Many features of this command can be set through interactive commands or in a custom file.

 

TOP command syntax format:

Top [-] [d delay] [Q] [C] [s] [s]

D: Specifies the interval between two screen refreshes. Of course, you can use the S interactive command to change the interval.

Q: This option will enable top to be refreshed without any delay. If the caller has the superuser permission, top will run with the highest possible priority.

S: indicates the accumulative mode.

S: run the TOP Command in safe mode, which removes the potential risk of interactive commands.

I: make the top command not show idle or frozen Processes

C: display the entire command line instead of the command name

Process and Status display can be achieved through interactive commands

 

Displays the percentage of CPU time used by user mode, system mode, priority process (only those with a negative priority), idle, and other conditions, the time consumed by the priority process will also be included in the user and system time, so the total percentage will be greater than 100%. Memory usage statistics. This includes the total available memory, idle memory, used memory, shared memory, and the memory occupied by the buffer.

 

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

CPU status

The project in the first line indicates the current time, the system startup time (minutes), the number of users logged on to the current system, and the average 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.

The second behavior process is the total number of processes, the number of running processes, the number of stopped processes, and the number of dead processes.

0.3% us: Percentage of CPU occupied by US user space

1.0% Sy: Percentage of CPU occupied by kernel space

0.0% Ni: Percentage of CPU used by a process that has changed its priority in the process space

98.7% ID: Percentage of idle CPU

0.0% Wa: Percentage of CPU time waiting for Input and Output

0.0% hi

0.0% Si

The third act is the CPU status, which is used by the user, the system, the process, and idle process.

The end of the fourth line is the memory status, which is the average available memory, used memory, and idle memory, used for kernel buffer memory usage.

Fifth, the switching status is available swap capacity, used capacity, idle capacity, buffer swap capacity.

Buffer swap Zone capacity: the memory in the SWAp zone is exchanged and then switched to the memory, but the swap zone used has not been overwritten, this value indicates the size of the SWAp zone where the content already exists in the memory. When the corresponding memory is swapped out again, you do not have to write data to the swap zone.

 

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

A pid: process ID of each process

B ppid: the parent process ID of each process

C uid: uid of each process owner

D User: name of each process owner

E pr: priority of each process

F Ni: indicates the priority level of the process. A negative value indicates a high priority. A positive value indicates a low priority.

G size: the code size of the process, the data size, and the total size of the stack space. The unit is kb.

H % MEM, total length of physical memory used by the process, in seconds

Total virtual memory used by the I virt process, in KB, virt = swap + Res

The terminal number of the process enabled by j tty. Is it displayed if the process is not started from the terminal?

The final CPU used by k p is only meaningful in multiple CPU Environments

L % percentage of CPU time occupied since the last CPU update to the present

M Time + total CPU usage time of processes. Unit: 1/100 seconds

N res process used, the size of physical memory not swapped out, unit: kb, Res = code + Data

The size of the physical memory occupied by the executable code of the O Code, in KB.

The size of the physical memory occupied by the unexpected part of p Data executable code (Data Segment + stack), in KB

Qshr shared memory size, in KB

R nflt page error count

S. Number of modified pages written to the present at the last time

T s Process status (D: Non-interrupted sleep status, R, run, s sleep, t trace/stop, and Z sticky)

 

Tsize: the code size of the process, which is a strange value about the kernel process.

Dsize: Data and stack size

TRS: Text resident size

D: Page items marked as "clean"

Lib: the size of the library page used. It does not work for the elf Process

RSS: total physical memory occupied by the process. Unit: KB

Share: number of shared memory used by the Process

Stat: the State of the process. s indicates sleep, D indicates non-disruptive sleep, r indicates running, and Z indicates dead, t indicates the stop or trace status.

In general, the top command is more powerful than PS, but it takes a long time to occupy the foreground. All users should use this command according to their own situation.

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.