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
|Requirements, Conventions or Software Version Used
|Any Linux distro
|free, lshw, GNOME System Monitor
|Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
How to check memory size in Linux (command line)
Check out some of the command line methods below to check your physical memory (RAM) size in Linux.
freecommand 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
-toptions. This will tell
freeto display RAM amounts in Gigabytes, make the amounts human readable, and give us the totals, respectively.
$ free -ght
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.
- The next method is not actually a command, but a file. The
meminfofile 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
lessto 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.
lshwcommand 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.
$ sudo apt install gnome-system-monitor
$ sudo dnf install gnome-system-monitor
$ sudo pacman -S gnome-system-monitor
- After installation, search for and open the GNOME System Monitor application. On the GNOME desktop environment, this should be inside of the
- With the application open, click on the ‘Resources’ tab at the top of the menu.
- You will see the total amount of physically installed memory where indicated in the screenshot below:
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.