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

What are the ways to view memory in Linux system

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

Editor to share with you what are the ways to check memory in the Linux system, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Method 1:free command

Since the free command is the most widely used and undoubtedly the most useful, we will first mention its usage. This command is used to check information about system RAM usage. Here are the commands you will enter in the terminal:

[root@linuxprobe] $free-m total used free shared buff/cache availableMem: 1821 1034 78 3 708 523Swap: 2047 51 1996

The available column represents the available memory. The column of used in the Swap entry is 51, which means it uses 51m and the free portion is 1996m.

Method 2:vmstat command

To view memory statistics through the vmstat command, you can use it in the following ways:

[root@linuxprobe] $vmstat-s 1865252 K total memory 1063392 K used memory 584000 K active memory 703272 K inactive memory 97844 K free memory 0 K buffer memory 704016 K swap cache 2097148 K total swap 53696 K used swap 2043452 K free swap 15894 non-nice user cpu ticks 1683 nice user cpu ticks 16806 system cpu ticks 1674779 idle cpu ticks 1359 IO-wait cpu ticks 0 IRQ cpu ticks 1758 softirq cpu ticks 0 stolen cpu ticks 5076596 pages paged in 702716 pages paged out 2139 pages swapped in 14109 pages swapped out 2046484 interrupts 3070821 CPU context switches 1544162333 boot time 26018 forks

The s tag provides detailed statistics about memory usage. You can view the available memory and available swap memory entries in the output to indicate the available memory in the system.

Method 3:/proc/meminfo command

The following command extracts memory-related information from the / proc file system. These files contain dynamic information about the system and kernel, rather than real system files. This is the command for printing memory information:

[root@linuxprobe ~] $cat / proc/meminfo

The output of this command is similar to the vmstat command. You can easily view the free memory in the MemFree results and the available swap memory in the SwapFree results.

Method 4:top command

The top command is used to print the system's CPU and memory usage. You can use this command as follows:

[root@linuxprobe ~] $top

In the title of the output, you can see the KiB Mem and Kib Swap entries, which allow you to check the used and available memory resources.

Method 5:htop command

Just like the top command, the htop command analyzes your CPU and memory usage in detail. If you do not have htop,Ubuntu installed on your system, you can install it by updating the abt repository with the following command:

$sudo apt-get update

Then enter the following command

$sudo apt install htop

Use the following command to install under CentOS:

[root@linuxprobe ~] $sudo yum install htop

After installing htop, you only need to print the required information using the following command:

[root@linuxprobe ~] $htop

The Mem (Memory, or RAM) and Swp (Swap) entries in the title represent the used and total memory, which allows you to calculate the available memory on the system.

Using the commands we mentioned in this article, you can monitor the system process memory. You can not use GUI at all, and you can still check memory usage on personal computers and servers.

The above is all the contents of the article "what are the ways to check memory in the Linux system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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

Development

Wechat

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

12
Report