How to check memory size in Linux

If you want to know the memory size of your Linux system, you will be relieved to know that it is not necessary to crack open the PC or boot into the BIOS screen to get your information. Linux allows us to check our memory size, and other relevant information such as spare slots and RAM speed, etc, all from within the operating system. We will go over some of these hardware checking methods below.

In this tutorial, you will learn how to check the physical memory (RAM) size that is installed on your computer. We will go over several command line and GUI methods below, which should work for any Linux distro that you may be using.

In this tutorial you will learn:

  • How to check memory size via command line
  • How to check memory size via GNOME System Monitor
How to check memory size in Linux
How to check memory size in Linux
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Linux distro
Software free, lshw, GNOME System Monitor
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to check memory size in Linux (command line)



Twitter icon Follow LinuxConfig.org on Twitter for the latest tips and tricks about Linux!


Check out some of the command line methods below to check your physical memory (RAM) size in Linux.

  1. The free command will give us information about current RAM usage, and break down how it is being utilized across our system. But it also gives us a clear indicator of exactly how much memory we have installed in our system. For best results, we recommend using the -g, -h, and -t options. This will tell free to display RAM amounts in Gigabytes, make the amounts human readable, and give us the totals, respectively.
    $ free -ght
    
    The first line shows our total installed memory
    The first line shows our total installed memory

    You can ignore the swap memory here since that is not physically installed RAM. The line you want to pay attention to is the very first one. In our example, we have 3.8 GB of RAM installed.

  2. The next method is not actually a command, but a file. The meminfo file contains a lot of information about the RAM installed in our system, and is what many other commands query in order to display their data. You can just use cat or less to view the file:
    $ less /proc/meminfo
    

    The very first line displays what you need to see. But you may also be interested in the plethora of other information displayed by this file.

    Output from the /proc/meminfo file on Linux
    Output from the /proc/meminfo file on Linux
  3. The lshw command can detect the number of RAM slots used, speed, and size. You must execute this command with root permissions.
    $ sudo lshw -C memory -short
    



How to check memory size in Linux (GUI method)

There are many GUI applications which can be used to check the amount of physically installed memory. But the one that we will be going over in this section is called GNOME System Monitor. If you are already using the GNOME desktop environment, then GNOME System Monitor should already be installed by default. But if you do not already have the application, follow the installation instructions below:

You can use the appropriate command below to install the GNOME System Monitor with your system’s package manager.

To install the GNOME System Monitor on Ubuntu, Debian, and Linux Mint:

$ sudo apt install gnome-system-monitor

To install the GNOME System Monitor on Fedora, CentOS, AlmaLinux, and Red Hat:

$ sudo dnf install gnome-system-monitor

To install the GNOME System Monitor on Arch Linux and Manjaro:

$ sudo pacman -S gnome-system-monitor
  1. After installation, search for and open the GNOME System Monitor application. On the GNOME desktop environment, this should be inside of the Activites menu.
    Searching for and opening the GNOME System Monitor application
    Searching for and opening the GNOME System Monitor application
  2. With the application open, click on the ‘Resources’ tab at the top of the menu.
    Navigating to the Resources tab in GNOME System Monitor application
    Navigating to the Resources tab in GNOME System Monitor application
  3. You will see the total amount of physically installed memory where indicated in the screenshot below:
    GNOME System Monitor showing the total amount of installed RAM
    GNOME System Monitor showing the total amount of installed RAM


Closing Thoughts

In this tutorial, we saw how to check the memory size on a Linux system. These commands and the GUI program should help you get to know your hardware without forcing you to crack open the PC and examining individual components. This ends up saving a lot of time and gives us a concise output of what RAM is installed in our system.



Comments and Discussions
Linux Forum