The top command is a tool for viewing system performance that shows the status of individual processes in real time, including process IDs, memory usage, CPU usage, and so on.
top-23:12:04 up/8:14, 1 user, load average:0.00, 0.01, 0.05tasks:573 Total, 2 running, 571 sleeping, 0 Stopped, 0 zombiecpu (s): 0.2%us, 0.4%sy, 0.0%ni, 99.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%stmem:198450624k Total, 35993240k used, 162457384k free, 797292k buffersswap:7999952k total, 0k used, 7999952k free, 11083744k cached
The meaning of the former five elements is, the first line,. System current time and run time, connected users, 1 minutes, 5 minutes and 15 minutes of load situation
The second line of the system has 573 processes, of which 2 are running, 571 are in hibernation, and 0 stop,0 are in a zombie process.
In the third row, the user space consumes 0.2 CPU, the kernel space consumes 0.4 CPU, the process of changing priority is CPU 0, the idle CPU is 99.5, the hard interrupt consumes CPU is 0, the soft interrupt consumes CPU is 0
Row four, total memory is 198, memory is 35, free memory is 162, cache memory is 7.
Five, the swap partition has a total of 79, use 0, idle 79, buffer swap partition is 11
By the number 1, you can toggle multi-core CPU display. Press the letter B, you can highlight the current process, press the letter X, you can highlight the CPU for sorting.
Press SHIFT + > or SHIFT + < To change the column to the right or left
Example 1 shows the full command
Top-c
Example 2 display in batch mode
Top-b
Example 3 shown in cumulative form
Top-s
Example 4 shows the information for a process
Top-p 7522
Some of the interactive commands in top
Some of the interactive commands that you can use during the top command execution. These commands are single-letter, and some of these commands may be masked if the S option is used on the command line. H Displays the help screen, gives some brief command summary instructions K terminates a process. I ignore idle and zombie processes. This is a switch-type command. Q Exit program R reschedule a process priority s switch to cumulative mode s to change the delay time between two refreshes (in units of s), and if there are decimals, convert to M S. Enter 0 value then the system will refresh continuously, the default value is 5 SF or F Add or remove items from the current display o or O change the order of display items L toggle display average load and start time information m Toggle display memory information T toggle display process and CPU status information C Toggle display command name and full command line M Sort based on resident memory size p sort by percentage of CPU usage T sort by time/cumulative time W writes the current setting to the ~/.TOPRC file
The free command can be used to display idle, used physical memory and swap memory in the system, buffer used in the kernel, and shared memory will be ignored.
-B Displays memory usage in bytes. -K displays memory usage in kilobytes. -m displays memory usage in megabytes. -G displays memory usage in gigabytes.
Example 1
$free -g total used free shared buffers cachedmem: 189 35 154 0 0 10-/+ buffers/cache: 23 165swap: 7 0 7
Total 189G memory, using 35G, free 154G, multiple process shared memory is 0, disk cache memory is 0
The second row of data is added to the cached data
Data for the third row is virtual memory information
Example 2 shows the sum of memory
$free-t total used free shared buffers cachedmem:198450624 36704832 161745792 0 797528 11520004-/+ buffers/cache:24387300 174063324swap:7999952 0 7999952Total: 206450576 36704832 169745744
Example 3 The memory information is displayed once per 10s
Free-s 10
Reference Documentation:
Http://www.cnblogs.com/peida/archive/2012/12/24/2831353.html
Http://www.cnblogs.com/peida/archive/2012/12/25/2831814.html
Linux Command--top Command &free command