How to view the resources used by the Linux system (top, free, and uptime)

Source: Internet
Author: User

How to view the resources used by the Linux system (top, free, and uptime)
The items in the first line are the current time, system startup time, number of users logged on to the current system, and average load. However, it consumes a lot of system resources.

Top

1. Role
The top command is used to displayProgramProcess. The permission is granted to all users.

2. Format
Top [-] [d delay] [Q] [C] [s] [s] [I] [N]

3. Main Parameters
D: Specify the update interval, in seconds.
Q: there are no delayed updates. If a Super User exists, the top command is executed in the highest priority order.
C: displays the complete process path and name.
S: The accumulation mode, which accumulates the CPU time of the completed or disappearing sub-itinerary.
S: security mode.
I: no idle (idle) or useless (zombie) itinerary is displayed.
N: displays the number of updates. After the update is completed, the system will exit the top.

Click to view the chart

Figure 1 display of top commands

In Figure 1, the items in the first line are the current time,SystemStart time, currentSystemNumber of logon users and average load. The second line shows all started processes, currently running, suspended and useless processes. The third line shows the current CPU usage, including the proportion occupied by the system, user usage, and idle ratio. The fourth line shows the usage of physical memory, including the total available memory, used memory, idle memory, and memory occupied by the buffer. The fifth line shows the swap partition usage, including the total swap partition, used, idle, and cache size. The sixth line displays the largest number of items. The detailed explanations are listed below.
PID (process ID): process ID.
User: the user name of the process owner.
PR: process priority.
Ni: the priority value of the process.
Virt: Virtual Memory occupied by the process.
Res: The physical memory occupied by the process.
SHR: the shared memory value used by the process.
S: Process status. s indicates sleep, r indicates running, Z indicates frozen, and N indicates that the priority of the process is negative.
% CPU: CPU usage occupied by the process.
% Mem: Percentage of physical memory and total memory occupied by the process.
Time +: The total CPU time occupied by the process after it is started.
Command: the name of the startup command that the process starts. If this line does not appear, the process has a complete command line.
Some interactive commands can be used to complete other parameter functions during the use of the top command. These commands are started by using the shortcut key.
<Space>: refresh immediately.
P: sort by CPU usage.
T: sort by time and accumulated time.
Q: exit the TOP command.
M: Switch to Display memory information.
T: process and CPU status information is displayed during switchover.
C: Switch the display command name and the complete command line.
M: sort by memory size.
W: Write the current settings ~ /. Toprc file. This is a recommended method for writing top configuration files.

As you can see, the top command is a powerful tool for monitoring the system, especially for system administrators. However, its disadvantage is that it will consume a lot of systemsResources.

Additional reading:Linux commands: c -- uptime

Uptime permission: usage of all users: uptime [-v] Description: uptime provides the following information for users, without other parameters: the number of users connected to the current time when the system starts up to the current time is the last minute, the system load parameters for five minutes and fifteen minutes:-V displays version information.

Compared with the top command, it is easy to use and only occupies a small amount of system resources. The-S parameter allows you to use the free command to continuously monitor the number of inactive instances. This allows you to use it as a convenient real-time monitor.

Free

1. Role
The free command is used to display memory usage. The permission is applied to all users.

2. Format
Free[-B |-k |-M] [-O] [-s delay] [-T] [-v]

3. Main Parameters
-B-K-M: memory usage is displayed in bytes (kb, MB.
-S delay: the number of seconds to display the memory usage.
-T: displays the total memory column.
-O: the buffer adjustment column is not displayed.

4. Application Instance
The free command is the main command used to view memory usage. Compared with the top command, it is easy to use and occupies only a small amount of resources.System Resources. The-S parameter allows you to use the free command to continuously monitor the number of inactive instances. This allows you to use it as a convenient real-time monitor.
# Free-B-S5

With this command, the slave node continuously reports memory usage (in bytes) and updates every 5 seconds.

Click to view the chart

Additional reading:Linux commands: c -- uptime

Uptime permission: usage of all users: uptime [-v] Description: uptime provides the following information for users, without other parameters: the number of users connected to the current time when the system starts up to the current time is the last minute, the system load parameters for five minutes and fifteen minutes:-V displays version information.

I have seen that the load avarage <3 system is good, and more than 5 has serious performance problems. Note that this value should also be divided by the number of CPUs. If load avarage = 8, CPU = 2.666/3 = 2.66, the value indicates that the system is in good state and greater than 5 is not necessarily a serious performance problem.

Uptime command

I used to see that load avarage <3SystemGood. If it is greater than 5, there will be serious performance problems. Note that this value should also be divided by the number of CPUs.

If load avarage = 8, CPU = 3, 8/3 = 2.666, 2.66 indicatesSystemGood status
More than 5 is not necessarily a serious performance problem. It may be that the service provided by the host exceeds the capability provided by the host and needs to be expanded. Take a look.

Click to view the chart

Next time, we will discuss two useful commands: vmstat and iostat.

Qqread.com file_win original

Additional reading:Linux commands: c -- uptime

Uptime permission: usage of all users: uptime [-v] Description: uptime provides the following information for users, without other parameters: the number of users connected to the current time when the system starts up to the current time is the last minute, the system load parameters for five minutes and fifteen minutes:-V displays version information.


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.