In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to check the usage of system resources under Linux". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to check the usage of system resources under Linux.
Information about CPU. When there is more than one CPU, these may be more than two lines. Eg.
Tasks: 115 total, 1 running, 114 sleeping, 0stopped, 0zombie
Cpu (s): 16.1% us, 2.0% sy, 0.0% ni, 79.5% id, 1.4% wa, 0.0% hi, 1.0% si
Tasks: 115 total number of total processes
1 running number of running processes
Number of sleeping sleep processes
0 stopped number of stopped processes
0 zombie number of zombie processes
Cpu (s): 16.1% us user space occupies CPU percentage
2.0% sy kernel space occupies CPU percentage
Percentage of CPU occupied by processes that have changed priorities in the process space of 0.0% ni users
79.5% id idle CPU%
1.4% percentage of CPU time wa waits for input and output
0.0% hi
0.0% si
The last two behaviors are memory information. Eg.
Mem: 8169876 k total, 7686472 k used, 483404 k free, 35272 k buffers
Swap: 4096532 k total, 160 k used, 4096372 k free, 2477532 k cached
Mem: 8169876 ktotal total physical memory
Total physical memory used by 7686472 k used
483404 k free total free memory
35272 k buffers memory used as kernel cache
Swap: total 4096532 k total switching partitions
Total number of switching areas used by 160k used
Total 4096372 k free free swap area
The total number of swap areas buffered by 2477532 k cached.
The contents of the memory are swapped out to the swap area, and then swapped into memory, but the used swap area has not been overwritten, and this value is the size of the swap area where these contents already exist in memory. When the corresponding memory is swapped out again, there is no need to write to the swap area.
Process information
The details of each process are displayed at the bottom of the statistics area. First of all, let's understand the meaning of each column.
PID USER PR NI VIRT RES SHR S CPU MEM TIME+ COMMAND
Serial number column name meaning
PID process id
PPID parent process id
RUSER Realusername
User id of the UID process owner
User name of the owner of the USER process
Group name of the owner of the GROUP process
The terminal name of the TTY startup process. Processes that are not started from the terminal are displayed as?
PR priority
NInice value. Negative values indicate high priority, while positive values indicate low priority.
P the last use of CPU makes sense only in a multi-CPU environment
% percentage of time spent by CPU from last update to present CPU
Total CPU time used by TIME processes (in seconds)
Total CPU time used by the TIME+ process (in 100 seconds)
% percentage of physical memory used by the MEM process
The total amount of virtual memory used by the VIRT process, in kb. VIRT=SWAP+RES
The size of the virtual memory used by the SWAP process, in kb.
The amount of physical memory used by the RES process that has not been swapped, in kb. RES=CODE+DATA
The amount of physical memory occupied by CODE executable code, in kb
The amount of physical memory occupied by parts other than DATA executable code (data segment + stack), in kb
SHR shared memory size (in kb)
Number of nFLT page errors
The number of pages that nDRT has modified since it was last written.
S process status.
D = uninterruptible sleep state
R = run
S = sleep
T = track / stop
Z = zombie process
COMMAND command name / command line
WCHAN displays the name of the system function in sleep if the process is sleeping
Flags task flag, refer to sched.h
Sort by specified column
Top can be set to sort by a certain item. By default, it is sorted by CPU usage.
M, (note uppercase), sort by memory usage
P, sorted by percentage of CPU usage
T, sorted by time / cumulative time.
How to end the process
Enter the letter k (lowercase), and then enter the PID of the desired kill
Of course, you can also run the command directly, kill PID
As you can see, the top command is a very powerful tool for monitoring the system, especially for system administrators. However, its disadvantage is that it consumes a lot of system resources.
II. Free command
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.
4. Application example
The free command is the main command used to view memory usage. Compared with the top command, it has the advantage of being easy to use and consuming only a small amount of system resources. With the-S parameter, you can use the free command to continuously monitor how much memory is used, so that it 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), updated every 5 seconds.
3. Uptime command
In the linux system, there is a saying that when load avarage
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.