Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to view ubuntu system resource usage

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to view ubuntu system resource occupation", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "how to view ubuntu system resource occupation" bar!

The command to view the resource usage of ubuntu is $: top

The top command can view memory, cpu, and processes

Top:

Main parameters

D: specifies the interval between updates, measured in seconds.

Q: there are no delayed updates. If the user has a superuser, the top command will be executed in the highest priority.

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

S: cumulative mode, which accumulates the CPU time of subtrips that have been completed or disappeared.

S: safe mode.

I: do not show any idle (Idle) or useless (Zombie) itinerary.

N: displays the number of updates. After completion, you will exit to.

Display parameters:

PID (Process ID): the process identification number.

USER: the user name of the process owner.

PR: the priority of the process.

NI: the priority value of the process.

VIRT: the virtual memory value occupied by the process.

RES: the physical memory value occupied by the process.

SHR: the shared memory value used by the process.

S: the state of the process, where S indicates hibernation, R indicates running, Z indicates dead state, and N indicates that the process priority value is negative.

% CPU: the CPU usage occupied by this process.

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

TIME+: the total CPU time spent by the process since it was started.

Command: the name of the startup command that the process starts. If this line is not displayed, the process will have a complete command line.

Top command

Space: refresh immediately.

P: sort by CPU usage size.

T: sort according to time and cumulative time.

Q: exit the top command.

M: toggles the display of memory information.

T: toggles the display of process and CPU status information.

C: toggles the display command name and the full command line.

M: sort by the amount of memory used.

W: writes the current settings to the ~ / .toprc file. This is the recommended way to write top configuration files.

Free

1. Action

The free command is used to show memory usage, with permissions for all users.

two。 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: the buffer adjustment column is not displayed.

Uptime

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

The time now

The elapsed time between the startup and operation of the system

Number of connected users

The last one minute, five minutes and fifteen minutes of system load

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 52 1161 698 26 31 70

1 observe disk activity

Disk activity is mainly understood from the following metrics:

Bi: represents the number of blocks per second read from disk (blocks/s). The higher the number, the more activity it takes to read the disk.

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

The percentage of time that wa:cpu waited for disk Imax O (pending disk IO). The higher the number, the more serious the situation in which file system activity hinders cpu, because cpu is waiting for slow disk systems to provide data. A wa of 0 is ideal. If wa is often greater than 10, the file system may need to be tuned for performance.

2 observe the activity of cpu

Vmstat reflects cpu usage better than top:

Us: the percentage of time that the user program uses cpu. The higher this number, the busier the user process.

Sy: the percentage of time that the system call uses cpu. Note that because NFS runs in the kernel, the cpu time consumed by NFS activities is reflected in sy. If this number is often large, you need to pay attention to whether a kernel process, such as NFS, is onerous. If both us and sy are large at the same time, you need to consider separating some user programs to another server so as not to interfere with each other.

The percentage of time id:cpu is idle.

The percentage of time that wa:cpu waits for pending disk IO.

Iostat

It is used to count the usage of CPU and the I / 0 of tty devices, hard drives and CD-ROM.

Parameters:

-c displays only CPU lines

-d display disk row

-k displays disk output in kilobytes

-t includes a 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 while% iowait waits for local Imax O

Percentage of CPU idle time when% idle is not waiting for local Iramp O

Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn

Hda 9.86 284.34 84.48 685407 2036

The total number of transfers per second (tps), 512 byte block reads per second (Blk_read/s), 512 byte block writes per second (Blk_wrtn/s), and 512 byte block reads (Blk_read) and writes (Blk_wrtn).

Thank you for your reading, the above is "how to view the ubuntu system resource occupation" content, after the study of this article, I believe you on how to view the ubuntu system resource occupation of this problem has a deeper understanding, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report