Ubuntu

How to Check Total RAM on Ubuntu 22.04?

How to Check Total RAM on Ubuntu 22.04 copy

RAM or Random Access Memory is used for short-term memory, i.e. it temporarily stores data. RAM works simultaneously with the CPU for better performance as it can transfer data faster and one can also write data faster to it. RAM Memory Management is also of great importance for the overall performance of the Ubuntu System.

This article discusses multiple methods of checking the Total RAM on Ubuntu 22.04.

How to Check Total RAM on Ubuntu 22.04?

The RAM Details usually contain Information about the Total RAM Memory, RAM Memory in use, and the RAM Memory Cached or Available. The System Monitor Application through GUI can be used to display the RAM Details and apart from that, Multiple Methods with Commands can also be used to display the RAM Details. These Methods are:

  • Check Total RAM using the “free” Command.
  • Check Total RAM using the “vmstat” Command.
  • Retrieve RAM Details from “meminfo” File.
  • Check Total RAM using the “top” Command.
  • Check Total RAM using the “htop” Command.
  • Check Total RAM using the “dmidecode” Command.
  • Check the Total RAM Using the System Monitor.

Method 1: Check Total RAM on Ubuntu 22.04 Using the “free” Command

The “free” Command in Ubuntu displays the RAM Memory Details including the RAM total memory, the used memory, the free memory, the shared RAM, the cached memory, and the available RAM. The “free” command to list RAM details is:

free -m

The “Mem” Row displays the RAM Details in MegaBytes (MB) in Terminal:

To display the RAM Details with “Gi” for GigaBytes and “Mi” for MegaBytes, the “-h” option is used with the “free” command:

free -h

The “Gi” and the “Mi” represent the respective RAM Memory in the Terminal:

As the resources in our Ubuntu System consume the RAM Memory every millisecond, the RAM usage and available Memory changes accordingly. The “free” command can also be used along with the “watch” Command to display the RAM Details in real-time:

watch free

It changes the details every 2 seconds making it easier for you to track the memory usage more accurately:

Method 2: Check Total RAM on Ubuntu 22.04 Using the “vmstat” Command

The “vmstat” command displays the Kernel Threads details. It lists the memory information, running processes, disk details, and many others. To Check the total RAM on your Ubuntu System, the “vmstat” command will be used:

vmstat -s

The “-s” option filters the details to only display a quick overview of Memory Usage:

Method 3: Check the Total RAM on Ubuntu 22.04 with the “meminfo” File

The “meminfo” file contains the Memory Information of your Ubuntu System. To get and display the content inside the “meminfo” file, the “cat” command is used along with the path to the “meminfo” file:

cat /proc/meminfo

The “MemTotal” displays the Total RAM Memory in Bytes, the “MemFree” displays the Free RAM Memory available in Bytes, and the other RAM Details are also displayed in the Terminal:

Method 4: Check Total RAM on Ubuntu 22.04 Using the “top” Command

Just like the Windows Operating System has the Task Manager, the Ubuntu Operating System lists the tasks and processes with the “top” command. The RAM Usage by the processes is also displayed by the Top Command. The top command can simply be used by typing the “top” command in the Terminal:

top

At the top of the Statistical Information, the “MiB Mem” displays the RAM Information that includes the Total RAM Memory in MBs, the Free RAM Memory in MBs, the Used RAM Memory in MBs, and the Cached RAM Memory in MBs:

Method 5: Check the Total RAM on Ubuntu 22.04 Using the “htop” Command

The “htop” command is like the top command but it is more visually appealing to the users. With the “htop” command, in the processes list, a user can scroll vertically and horizontally unlike the “top” command where the user is restricted to viewing only one page on the Terminal. A user can even select a process from the “htop” processes list.

The “htop” command is not pre-installed in Ubuntu. To install the “htop” command, first, you need to update and upgrade the existing Ubuntu Packages with the following “sudo” command:

sudo apt-get update && sudo apt-get upgrade

This will update and upgrade any packages that require an update:

Once the packages are upgraded, install the “htop” utility with the below-given command:

sudo apt install htop

It will start installing the “htop” packages, wait for the installation process to complete:

The installation when completed will add the “htop” utility to your Ubuntu System and can be used in the Terminal directly using the following snippet:

htop

The information about Processes and Resources used can be seen in the Terminal in a more visually appealing way. A process can also be selected by just clicking on it. The “Mem” bar displays the total RAM Memory and the currently in use RAM Memory:

Method 6: Check the Total RAM on Ubuntu 22.04 Through the RAM Type Details

The RAM Type Details can be checked with the “dmidecode –type memory”. This command retrieves Information about the System Hardware which includes Processor, RAM, and BIOS. The command to retrieve the RAM Details is stated in the following code block:

sudo dmidecode --type memory | less

The Terminal will list the Memory Module that is currently in use. In our case, it displays the RAM Details where we can see the Maximum Memory Size and the Minimum Memory Size:

Method 7: Check the Total RAM on Ubuntu 22.04 Through the System Monitor

Instead of using only the Terminal to check the RAM Details, the System Monitor through the GUI Method can also be used to check the Total RAM. To open System Monitor, click on the “Navigation Menu”:

You can either use the Search Box to search for “System Monitor” or you can manually look for the System Monitor in the Applications. Select the System Monitor Icon to start the System Monitor Application:

The System Monitor starts and you can see the List of Running Applications on your Ubuntu System. You can also see the resources those processes are utilizing. In the Navigation Menu, click on the “Resources” Option:

The Resources Menu will display the resources and memory usage of RAM, CPU, and Network separately. In the following Memory Graph, you can see the total memory of RAM, in our case, the Total RAM is 8.3GB:

That’s all about checking the total RAM on Ubuntu 22.04.

Conclusion

To check the RAM on Ubuntu, either of the “free”, “vmstat”, “meminfo”, “top”, “htop”, or “dmidecode” commands can be used in the Terminal. To check the RAM through GUI, the System Monitor Application can be used. This article explained each command in detail along with the process of finding total RAM through the GUI.

Similar Posts