1. Home
  2. Linux

Linux: Check RAM size on a PC

At some point, while running your Linux PC, you may be curious as to what your RAM size is. Thankfully, because of the Linux platform’s robustness, it is straightforward to check how big your RAM is. 

This tutorial will go over several ways to check the RAM size on the Linux desktop. However, these methods are also applicable to Linux servers as well!

Linux check ram size – Free 

linux check RAM size

If you’re looking to check the RAM size on your Linux PC, the best way to do it is with the free command. The free command comes with all Linux operating systems, and users use it to check physical RAM size, physical RAM usage, SWAP size, SWAP usage, etc.

To check your RAM size, you’ll need to start by opening up a terminal window. To open a terminal window on the Linux desktop, you can press the Ctrl + Alt + T keyboard combination. Or, search for “Terminal” in the app menu on your PC.

Once the terminal window is open, you can execute the free command. When the free command runs in the terminal, it will show you a quick snapshot of your RAM and SWAP usage on Linux. To determine the size of your total RAM, look under the “total” column.

Keep in mind that the free command, by default, prints out the information in bit format. While useful to advanced users, this format is next to impossible to read for the average person. Thankfully, you can change the output so that it is written in Kilobytes/Megabytes/Gigabytes, using the -h switch.

free -h

After running the free command with the –command-line switch, you’ll notice that all output numbers are now “human-readable.” From here, you can determine the exact size of your physical RAM by looking at the number under “total” next to “mem.”

Want to save the information from running the free command? Pipe it into a text file. To export the output, execute the command below in a terminal window.

free -h > ~/my-ram-info.txt

Once you have exported your ram info from the free command to a text file, you can execute the cat command to view the file’s contents right in the terminal. Or, open it in your favorite GUI text editor.

cat ~/my-ram-info.txt

Linux check ram size – Htop task manager

Another easy way to check the RAM size on a Linux system is with the Htop task manager. Htop runs in the terminal, and it provides real-time monitoring of running programs. It also measures RAM usage, and you can use it to tell how large your RAM is on your system.

However, before we can get into how to use Htop to determine RAM size on Linux, we must demonstrate how to install the app. We must explain how to install it because the app isn’t installed by default on all Linux operating systems.

To start the installation of Htop, open up a terminal window. Once the terminal window is open and ready to use, follow the command-line installation instructions outlined below that corresponds with your Linux OS.


sudo apt install htop


sudo apt-get install htop

Arch Linux

sudo pacman -S htop


sudo dnf install htop


sudo zypper install htop

Once the app is set up on your computer, return to the terminal window. In the terminal window, execute the htop command below. By running this command, the Htop task manager will start up and be ready to use. 

With the Htop app open, you will see an overview of your system, as well as running programs. You should also see the “Mem” section, followed by a graph.

At the end of the “Mem” graph, there are two numbers. The first number indicates how much RAM is in use at the current time. The second number is your total RAM size. 

Linux check ram size – Meminfo

If Free or HTOP doesn’t do it for you, you can also check your RAM size by looking at the /proc/meminfo file. The meminfo file is a Linux system file, and it notes exactly how much physical RAM you have. Though, it’s displayed in Kilobytes, so the average user won’t find this as useful as the other options we’ve covered in this guide.

To view your memory from the meminfo file, open up a terminal window. Then, execute the head command below.

head /proc/meminfo

Look through the output for “MemTotal.” The numbers after that note your exact RAM size on your Linux system. Alternatively, you can run the cat command and filter out just “MemTotal” to only show that line from the file.

cat /proc/meminfo | grep MemTotal

Want to save the “MemTotal” number to a text file for reading at a later date? Pipe it to a text file with the command below.

cat /proc/meminfo | grep MemTotal > my-memtotal.txt

Want to free up RAM on your Linux system? Check out this guide.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.