Linux Viewing System Resource Usage

Source: Internet
Author: User
Tags cpu usage

Linux Viewing System Resource Usage

During system maintenance, it may be necessary to review CPU and memory usage at any time, and to analyze the system's health needs based on the corresponding information. This article describes several common Linux system Resource View commands.

1. View of overall memory consumption

Command: Free

Figure 1 The free command to view memory consumption

(1) The free command is displayed by default in kilobytes and can be displayed in MB units with free-m.

(2) Mem line: total = used + free where buffers and cached are calculated within used, but are actually available memory.

(3) Mem Next line: Used is the real memory, free is the real available memory.

(4) Swap: Use of memory swap area.

2. Review the memory footprint of the top five process

Command: PS Auxw | Head-1;ps auxw|sort-rn-k4|head-5

Figure 2.1 Viewing the memory footprint of the top 5 process

2.1, the unit of memory is Kb,vsz is the use of virtual memory, RSS is the actual memory consumption.

Command decomposition:

PS AUXW Display system resource usage;

Head-1 indicates that the first column, the title column, is displayed;

Sort-r indicates a reverse sort,-n means sort by number, and-k4 represents the 4th character of the column.

3. View the top three CPU usage process

Command: PS auxw|head-1;ps auxw|sort-rn-k3|head-3

Figure 3.1 Viewing the top three process of CPU consumption

This command is similar to Figure 2.1, only the 3rd column of the selected resource occupancy (that is, the CPU), denoted by "-k3".

4. View the overall system load

Command: Top

Figure 4.1 Top Display System overall load

(1) The first line: System time + system run time + several users + 1/5/15 minutes system average load

(2) Second line: Total number of processes + number of running processes (running) + Number of sleep processes (sleeping) + number of processes stopped (stopped) + Number of zombie processes (zombie)

(3) Third line: User space CPU ratio (US) + kernel space CPU ratio (SY) + CPU vacancy rate (ID)

Figure 4.2 Resource utilization for each task

Annotations:

PID: Process ID

User: Username

PR: Priority

NI: Negative value indicates high priority, positive value indicates low priority.

VIRT: Virtual Memory

RES: Real Memory

SHR: Shared Memory

S: Process state d= non-interruptible sleep state; r= run; s= sleep; t= track/stop; z= Zombie Process

Parameters:

Top-d 2: Explicit resource usage for all processes at 2-second intervals

TOP-C: The resource usage of the explicit process every 5 seconds and displays the process's command-line arguments (by default, only the process name)

Top-p 12345-p 6789: Display pid every 5 seconds is 12345 and the PID is 6789 of the resource consumption of two processes

top-d 2-c-P 123456: Shows the PID is 12345 of the resource usage of the process every 2 seconds, and explicitly the command-line arguments that the process started

-------------------------------------------------------------------------------------------------
Write some code, write some technology.
Public number "Software development information", met may wish to look at the attention.

Linux Viewing System Resource Usage

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.