View ubuntu system resource usage commands

Source: Internet
Author: User
Run the $: toptop command to view the memory usage of ubuntu resources, and run the $: top command to view the resources occupied by Ubuntu by the cpu and process.
Top command to view memory, cpu, and process
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.
Top Command
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.
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.