Description of top and free commands in Linux (GO)

Source: Internet
Author: User

Top: The command provides real-time status monitoring of the system's processor. It displays a list of the most "sensitive" tasks for the CPU in the system.

This command can be used on a per-CPU basis. Memory usage and execution time sorting tasks;

And many of the features of the command can be set through interactive commands or in personal customization files.

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

15:20.36 represents the current time

Up 109day system booting to the current run time

2 user Current number of users logged on

Load average:0.02, 0.04, 0.05 system load, that is, the average length of the task queue, three values are 1 minutes, 5 minutes, 15 minutes ago to the present average.

The second to third behavior process and CPU information. When there are multiple CPUs, the content may be more than two lines. The contents are as follows:

tasks:29 Total Process Totals

1 running number of running processes

Sleeping the number of sleep processes

0 Number of processes stopped stopped

0 Zombie Number of zombie processes

CPU (s): 0.3% US user space consumes CPU percentage

1.0% SY core space CPU percent occupied

0.0% CPU Percentage of processes that have changed priority within NI user process space

98.7% ID Idle CPU percent

0.0% wa wait for the input output CPU time percentage

0.0% Hi Hard Interrupt (Hardware IRQ)% of CPU occupied

0.0% si soft interrupt (software interrupts)% of CPU occupied

The last two behavior memory information. The contents are as follows:

MEM:191272K Total Physical Memory

Total physical memory used by 173656k used

17616k free Memory Total

The amount of memory that 22052k buffers uses as the kernel cache

Total swap area of swap:192772k

Total swap area used by 0k used

192772k Free Swap Area total

123988k cached Buffers The total number of swap areas. (

The in-memory content is swapped out to the swap area and then swapped in to memory, but the used swap area has not been overwritten.

This value is the size of the swap area where the content already exists in memory.

When the corresponding memory is swapped out again, it is no longer necessary to write to the swap area.

)

The details of each process are shown below the process information area statistics area. Let's start by understanding the meaning of the columns.

Ordinal column name meaning

PID Process ID

PPID Parent Process ID

Ruser Real User Name

User ID of the UID process owner

Username of user Process Owner

Group Process Owner's name

The terminal name of the TTY startup process. Processes that are not started from the terminal are displayed as?

PR-Priority

NI nice value. Negative values indicate high priority, positive values indicate low priority

P last used CPU, only meaningful in multi-CPU environment

%cpu percentage of CPU time that was last updated to current

The total CPU time, in seconds, used by the duration process

Total CPU time used by the time+ process, Unit 1/100 sec

Percentage of physical memory used by the%MEM process

The total amount of virtual memory used by the VIRT process, in kilobytes. Virt=swap+res

The swap process uses the amount of virtual memory that is swapped out, in kilobytes.

The size, in kilobytes, of the physical memory used by the RES process and not swapped out. Res=code+data

The amount of physical memory the code executable consumes, in kilobytes per kb

The amount of physical memory that is used outside the data executable code (segment + stack), in kilobytes

SHR shared memory size, in kilobytes

Nflt Number of page faults

NDRT the number of pages that were modified the last time it was written to.

W S Process state.

d= non-disruptive sleep state

R= Run

S= Sleep

t= Tracking/Stopping

z= Zombie Process

x command name/command line

Y Wchan If the process is sleeping, the system function name in sleep is displayed

Z Flags task Flag, reference sched.h

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

Change the display by using the F key to select what to display. Press the F key to display a list of columns, press A-Z to show or hide the corresponding column, and then press ENTER to confirm.

Press the O key to change the order in which the columns are displayed. A-Z in the lower case moves the corresponding column to the right, while the uppercase A-Z moves the corresponding column to the left. Finally, press ENTER to confirm.

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

The free command is used to display memory usage

B. Format

Free [-b-k-M] [-s delay] [-t] [-v]

C. Main parameters

-b-k-M: Displays memory usage in bytes (KB, MB), respectively.

-S delay: Displays the number of seconds per second to show memory usage.

-T: Displays the memory sum column.

After using this command, the terminal will continually report memory usage (in bytes), updated every 3 seconds

Total: The amount of physical memory.

Used: How large is used.

Free: How much is available.

Shared: The total amount of memory shared by multiple processes.

Buffers/cached: The size of the disk cache.

Third line (-/+ buffers/cached):

Used: How large is used.

Free: How much is available.

There is not much to explain in line four.

Difference: The used/free of the second line (MEM) differs from the third row (-/+ Buffers/cache) used/free. The difference between the two is that in terms of use,

The first line is from the OS point of view, because for the os,buffers/cached are all belong to be used, so his available memory is 16176KB, used memory is 3250004KB, which includes, the kernel (OS) uses +application (X, Oracle, etc) using the +buffers+cached.

The third line refers to the application from the point of view, buffers/cached is equal to the availability of the application, because buffer/cached is to improve the performance of the file read, when the application needs to use memory, buffer/cached will be quickly recycled.

So from the application's point of view, available memory = System Free memory+buffers+cached.

As in the above example:

2795064=16176+110652+2668236

Next, explain when the memory will be exchanged, and by what side. When the available memory is less than the rated value, a meeting is exchanged.

Memory-intensive measurements

To measure how much memory a process consumes, Linux provides a convenient way for us to provide all the information we have in the/proc directory, and in fact the top tools are also available here to obtain the appropriate information.

Memory usage information for/proc/meminfo machines

Description of top and free commands in Linux (GO)

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.