View system Resource Usage commands under Linux

Source: Internet
Author: User
Tags current time memory usage resource safe mode sort cpu usage

One, Top command

1. Role

The top command is used to display the program process in progress, with permissions being all users.

2. Format

Top [-] [D delay] [Q] [C] [s] [s] [i] [n]

3. Main parameters

D: Specifies the interval of the update, measured in seconds.

Q: No delayed updates. If the consumer has superuser, the top command executes with the highest precedence.

C: Displays the full path and name of the process.

S: Cumulative mode, which accumulates the CPU time of a completed or missing child stroke.

S: Safe mode.

I: Do not show any idle (Idle) or useless (Zombie) journeys.

N: Displays the number of updates, and will exit top when finished.

Figure 1 Display of the top command

In Figure 1, the first line represents the current time, the system start time, the number of current system logged-in users, and the average load. The second line shows all initiated processes, currently running, pending (sleeping), and useless (Zombie) processes. The third line shows the current CPU usage, including the proportion of system occupancy, user usage ratio, idle (Idle) ratio. The four lines show the use of physical memory, including total memory that can be used, memory used, free memory, and memory consumed by the buffer. Line five shows the usage of the swap partition, including the total swap partition, the use, the idle, and the size used for the cache. Line six shows the most items, and the following is a detailed explanation.

PID (Process ID): progress indicator number.

User: The username of the process owner.

PR: The priority level of the process.

NI: The priority value of the process.

Virt: The virtual memory value that the process occupies.

RES: The physical memory value that the process occupies.

SHR: The shared memory value that the process uses.

S: The state of the process where s indicates hibernation, R indicates that it is running, Z indicates zombie state, n indicates that process priority is negative.

%CPU: The CPU usage that the process occupies.

%mem: The percentage of physical memory and total memory consumed by the process.

Time+: The total CPU time that was consumed by the process after it was started.

Command: The name of the startup command that the process starts, and if this line does not appear, the process will have a complete command line.

When the top command is in use, you can also use some interactive commands to perform the functions of other parameters. These commands are started by using a shortcut key.

<: Refresh immediately.

P: Sort According to CPU usage size.

T: Sorted by Time, cumulative time.

Q: Exit Top command.

M: Toggle display memory information.

T: Toggles the display of process and CPU state information.

C: Toggle display command name and full command line.

M: Sort based on the size of memory used.

W: Writes the current settings to the ~/.TOPRC file. This is the recommended method for writing the top configuration file.

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

Two, free order

1. Role

The free command is used to display memory usage, which is used by all users.

2. Format

free [-b-k-m] [-O] [-s delay] [-t] [-v]

3. 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.

-O: Buffer throttling columns are not displayed.

4. Application examples

The free command is the primary command used to view memory usage. The advantage of the top command is that it is simple to use and takes up only a small amount of system resources. The-s parameter allows you to use the free command to continuously monitor how much memory is in use, which can be used as a convenient real-time monitor.

#free-B-S5

After using this command, the terminal will continuously report memory usage (in bytes) and update every 5 seconds.

Iii. Uptime Order

In a Linux system, there is a saying that when the load avarage <3 system is good, greater than 5 has serious performance problems. Note that this value should also be divided by the number of CPUs.

If the load avarage=8, cpu=3,8/3=2.666,2.66 This value indicates that the system is in good condition

Greater than 5 is not necessarily a serious performance problem, it is possible that the host provides more services than he can provide and needs to be expanded. Have a concrete look.

In addition, under Linux to view the utilization of system resources, there are two commands, they are: Vmstat and Iostat. Interested friends, can also study under.

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.