System engineers are often required to check memory stats in their day to day tasks. In this article, we will discuss how you can check how much RAM is installed and used on your system CentOS 8 using the command line.
There are following commands are used to check the installed system’s RAM on CentOS 8.
- Using /proc/meminfo
- Using free command
- Using top command
- Using vmstat command
- Using dmidecode command
Using meminfo file
Open the terminal window on your system using shortcut keys “Ctrl + Alt + t”. Type the following command on the terminal to view the Installed RAM on your system:
$ cat /proc/meminfo
In the above-mentioned output, you can see the memory of your system. The ‘cat’ is used for file concatenation.
Using free command
To check the total free memory amount, physically used and swap memory, you will use the free command. The free command is also used to display the information about buffers that are used by the kernel and specifications of the RAM of your system. Type the following command to check the system’s memory:
$ free -m -h
You can use different options with the ‘free’ command to view the system’s memory information. The general syntax is as follows:
$ free [options]
Command-line options of the free command
The details of more free command is given below:
–help used to display help
-b,-k,-m, and -g displays output in kilobytes, Megabytes, or Gigabytes
-l display the detailed view of statistics low and high memory
-o use for old format (cache line/no -/+buffers/)
-t shows total for RAM + swap
-s use to update delay
-c use to update count
-V use to display information about version and exit
Using top command
The top command is used to display memory and buffers information. You will run the below-mentioned command on your system to view memory information.
Using vmstat command
The vmstat command is used to display the memory statistics in which the user can view some additional information related to processes, block IO, traps, paging, and CPU activity. Use the following command to print statistics of memory:
$ vmstat -s
Using dmidecode command
The dmidecode command is used for dumping table content of SMBIOS in a human-readable format. This table contains all the information related to the system’s hardware components and description of the serial number as well as BIOS revision. The basic syntax of the dmidecode command is as follows:
$ dmidecode --type memory
Using lshw command
The following command is used to view the memory information:
$ sudo lshw -short -C memory
In this article, we have learned how to check the system’s memory on CentOS 8.0 using the command line. I hope you have really enjoyed this tutorial and it would be helpful for you. If you have any problem related to the above-mentioned commands then please let us know through feedback in the comment box.