Preface Two types of swap space can be created under Linux, one is a swap partition and the other is a swap file. The former is suitable for free partitions, while the latter is suitable for hard disks with no free partitions and the hard disk space has been allocated. For example: when installing Red Hat, you can divide the hard disk space by default, and the size of the swap area is the system default configuration. When you need to install an Oracle database after installing the system, it suddenly warns that there is not enough swap space. What to do now? When the physical memory or RAM on our system is full, we end up utilizing the swap space on the system. During this process, inactive pages of memory are moved to swap space, creating more memory resources. This space is particularly useful when the system is powered off of RAM; however, swap space is located on the hard drive and is therefore slower to access. Therefore, it should not be considered a suitable alternative to RAM. In this article, we will look at several ways to check available swap space on your Ubuntu system. The commands and procedures described in this article have been run on an Ubuntu 18.04 LTS system. We are using the Ubuntu command line, the Terminal, to check the swap space on our system. To open Terminal, you can use the Dash or the Ctrl+alt+T shortcut. Then, you can choose the following ways to get swap space information: Linux free command Order:
This command is used to check the memory and swap utilization on the system in a few lines. Without any switches, the displayed output is printed in kilobytes. Check swap space using free command Order:
With the -h switch, the free command displays the memory and swap utilization in the nearest 3-digit format. free -h Command swapon Command Order: $ swapon -s You can check swap for a specific partition, logical volume, or file using the swapon command. Here, we will use the -s (summary) switch to get the exchange details in kilobytes. swapon Command top Command Order: $ top The header section of the top command output displays swap space information in kilobytes. Other commands that provide this information include htop, glances, and itop, among others. Check swap usage using top command vmstat Command Order: $ vmstat The vmstat command allows you to view swap and swapping information. However, you cannot see the total value of the swap as shown by the previously mentioned command. Check swap space using vmstat command /proc/swaps File Order: $ cat /proc/swaps You can also view swap size information via the swap configuration file /proc/swaps. It also displays swap information by device so that you can see the device name (partition, logical volume, or file), its type, and the amount of swap it provides to the system. Check the contents of /proc/swaps Although very simple commands are described in this article, you can view the swap space on your Ubuntu system and use it when your system is running low on RAM resources. Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: Summary of mysqladmin daily management commands under MySQL (must read)
>>: Example of implementing todo application with Vue
Responsive layout systems are already very common...
Based on Vue The core idea of this function is ...
Result: Implementation Code html <div id="...
This article uses examples to explain the princip...
Written in front When we operate the database in ...
This article introduces several methods of implem...
This article records the specific method of insta...
1. Top-level usage 1. Install cnpm npm i -g cnpm ...
Putting aside databases, what is dialect in life?...
10.4.1 The difference between Frameset and Frame ...
This article describes how to install and configu...
1. Getting started with setUp Briefly introduce t...
A simple license plate input component (vue) for ...
Preface Slow query log is a very important functi...
Recently, I have a project that requires using ifr...