Command for viewing system resource usage in linux

Source: Internet
Author: User
Article Title: commands used to view system resource usage in linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Top:

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, it will exit

Display parameters:

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.

   <空格> : 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.

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.

Uptime

18:59:15 up 25 min, 2 users, load average: 1.23, 1.32, 1.21

Current Time

How long has the system been running?

Number of connected users

System load in the last minute, five minutes, and fifteen minutes

Parameter:-V displays version information.

Vmstat

Procs ----------- memory ---------- --- swap -- ----- io ---- system -- ---- cpu ----

R B swpd free buff cache si so bi bo in cs us sy id wa

0 1 24980 10792 8296 47316 5 19 205 1161 698 26 3 1 70

1. Observe disk Activity

Disk activity is mainly based on the following indicators:

Bi: The number of blocks read from the disk per second (blocks/s ). The larger the number, the more disk read activity.

Bo: The number of blocks written to the disk per second (blocks/s ). The larger the number, the more disk write activity.

Wa: percentage of time when the cpu waits for disk I/O (pending disk IO. The larger the number, the more serious the file system activity hinders the cpu, because the cpu is waiting for the slow disk system to provide data. It is ideal to set wa to 0. If wa is often greater than 10, the file system may need to adjust its performance.

2. Observe cpu Activity

Vmstat better reflects cpu usage than top:

Us: The cpu usage time ratio of the user program. The larger the number, the busier the user process.

Sy: cpu usage time ratio for system calls. Note that NFS runs in the kernel, so the cpu time occupied by NFS activity is reflected in sy. If this number is large, you need to check whether a kernel process, such as NFS, is heavy. If both us and sy are large, you need to consider separating some user programs from other servers to avoid mutual influence.

Id: Percentage of idle cpu time.

Wa: percentage of time when the cpu waits for pending disk IO.

Iostat

Used to count CPU usage and tty device, hard disk and CD-ROM I/0 count

Parameters:

-C: Only CPU rows are displayed.

-D: Display disk lines

-K Displays disk output in kilobytes

-T include the timestamp in the output

-X includes extended disk metrics in the output

Avg-cpu: % user % nice % sys % iowait % idle

20.25 0.18 2.61 76.39 0.57

% Percentage of CPU idle time when iowait waits for local I/O

% Percentage of idle CPU time when idle does not wait for local I/O

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

Hda 9.86 284.34 84.48 685407 2036

Transmission per second (tps), 512 bytes of block read per second (Blk_read/s), 512 bytes of block write per second (Blk_wrtn/s), and 512 bytes of block read (Blk_read) and the total number of writes (Blk_wrtn.

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.