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
After many difficult single-step debugging late a...
When you start working on a project, it’s importa...
In the previous article https://www.jb51.net/arti...
Today I will share with you a breathing carousel ...
Table of contents Rendering API changes Render fu...
Install GeoIP on Linux yum install nginx-module-g...
I encountered a problem when I turned on my lapto...
tcpdump is a flexible and powerful packet capture...
Error description: 1. After installing Nginx (1.1...
When I was interviewing for a BI position at a ce...
Table of contents 1. Understanding the Equality R...
Method 1: Using the onclick event <input type=...
Drag and drop is a common function in the front e...
1. Environment and related software Virtual Machi...
Main library execution CREATE DATABASE test CHARA...