This post will examine a few key commands for CentOS 8 that help determine how much memory or RAM is available.
To check the memory usage, you should have sudo privileges.
How To Check Memory Usage Details Using GUI on CentOS 8
You can easily carry out the following action if you wish to check memory usage details using the graphical user interface (GUI). In the search box for the application, enter “system monitor”.
You can quickly check the RAM usage by selecting the “Resources” tab.
Linux Commands Used To Check the Memory Usage Details on CentOS 8
The five different methods available can help determine how much memory is in use. These methods are listed:
- Free command
- Cat command
- vmstat command
- Htop command
- Top command
Check Memory Usage Details Using the Free Command
The previous image displayed contains several concepts, each of which we will define individually.
- Used memory may be calculated using the formula used memory = total – free – buffer/cache.
- The total reflects the total memory installed on your machine.
- Free displays the memory that is not in use.
- Shared displays the amount of memory that is shared by various programs.
- Buffers the memory that the OS kernel has set aside. When a process demands additional memory, this memory is allocated as buffers.
- Cached memory is used to store recently accessed files in RAM.
- buff/cache Memory cache + buffers
- Available displays memory that can be used to begin new processes without swapping.
The information displayed in the previous screenshot, such as that under the words used, available, and swap memory, is in kilobytes.
You may examine the complete description and all the options of the free command by using the following command:
Check Memory Usage Details Using the “cat” Command
First, open the terminal window and type “cat /proc/meminfo”. This command displays the total memory usage and available memory information from a file “/proc/meminfo”.
This command displays the real-time details of memory usage and the information about shared memory, which is used by the buffers and kernel.
Check Memory Statistics Using the vmstat Command
To view comprehensive virtual memory statistics, use the vmstat command.
The memory, system processes, CPU activity, paging, block IO, and traps are all exposed by this command.
Display Memory Usage Details Using the htop Command
Like the top command, the htop command displays information. The htop command offers a user-friendly interface and improved control options.
The htop command has an interactive interface and can scroll the page horizontally and vertically. It also uses colors to present its output and provides a complete command-line environment for all processes. To exit the current window, press “Ctrl+c”.
The following information will appear on your terminal:
- The information summary and visual text counts are in the top area.
- The comprehensive information for each procedure is shown in the middle part. It is simple to carry out the various tasks on each distinct process.
- You can rapidly configure and manipulate the processes without using any commands, thanks to the list of all shortcuts at the bottom of the displayed window.
The following command can be used to install the htop utility if it isn’t already on your CentOS 8 system:
Check Memory Usage Details Using the top Command
The command-line tool top helps look at how much memory and CPU each process uses. It presents details about items, such as Uptime, average load, tasks running, user logged-in information, CPU utilization, swap and memory usage, and system processes.
The top command automatically updates the information on the terminal, allowing you to track the processes’ use of RAM in real-time.
This article has shown us how to monitor the memory usage details on the CentOS 8 system. Additionally, we have run other commands to display the memory information, including cat, free, vmstat, top, and htop. You may quickly find out information about your system’s RAM and CPU by using these instructions.