RAM, short for Random Access Memory can be considered the workspace of your computer system. Whenever you open a file for viewing or editing, your system creates a temporary instance of that file in your RAM so that you can work on it. When you save the file, your system copies it to a more stable and non-volatile space( hardware), called the Read Only Memory. Not only this, when you run a program, your operating system and RAM are the medium on which it is run. When you are looking for a high-performance computing system, a good balance of an adequately sized and fast RAM is your answer.

While using Ubuntu, we come across many scenarios where RAM is a huge consideration. We want to know how much RAM is installed on our system, how much of it we can use, is our RAM free of errors, and much more.

In this article, we will explain the following things you can do about your installed RAM, through the Ubuntu command line:

  • Check for Installed, Used and Available RAM
  • Check the Type and Speed of your installed RAM
  • Test your installed RAM for errors

We have run the command and procedures mentioned in this article on a Ubuntu 18.04 LTS system.

Note: We will be using the Ubuntu command line, the Terminal, in order to explain the above-mentioned tasks. You can open the Terminal application either through the Ubuntu Application launcher search bar or through the Ctrl+Alt+T shortcut.

How to check the Installed, Used and Available RAM

The simplest way to check for memory stats on your Ubuntu is through the free command:

This is how you use the free command:

$ free

Use:

This command is used to check memory and swap utilization on your system in a few lines. Without the use of any switch, the displayed output is printed in kilobytes.

Free command

However, a better approach is to use the -h switch so that the free command displays the memory and swap utilization in nearest possible-3 digit format.

$ free -h

Free -h command

The “Mem” part of the output gives you information about the RAM on your system. The total column gives you the total GBs of RAM installed on your system. The used and available columns indicate the RAM that is in use by your system and the GBs available for use, respectively.

How to check the Type and Speed of RAM

Before explaining how to check the Type and Speed of your RAM, let us first define what they both mean:

  • Type: RAM these days comes in many profiles based on the data and transfer rates. These include the older SDRAM(Synchronous dynamic RAM), the DDR1(DDR SDRAM), DDR2, DDR3, and the modern DDR4. For portable systems, RAM comes in DRAM and SDRAM types.
  • Speed: When we talk about the speed of RAM in MHz or GHz, we are considering the clock cycles. A cycle means a single read and write session. The speed of the RAM means how many cycles per seconds it can perform. A 3200 MHz RAM can perform 3200 cycles( read/write sessions) in one second

You can use the following command as sudo in order to check the type of your RAM

$ sudo dmidecode --type memory | less

The system will ask you for the password of sudo and then display the following information:

Check RAM type and speed in Linux

Scroll down and spot the Type of RAM in the output, as highlighted above. As you can see, I have DDR3 installed on my laptop.

Through the same command, you can also view the Clock Speed of your RAM:

The above output shows that I have 1333 MHz of RAM installed on my system.

You can use the ‘q’ key in order to quit this output.

How to Test RAM for errors through the MemTester utility

Since RAM is a fragile device, it’s semiconductors may at times face breakage. This might affect the performance of your overall RAM. You can make use of the MemTester to test your RAM for errors.

In order to install this utility, open your Terminal application and enter the following command in order to first update your system’s repository index with that of the Internet repositories. This ensures that the latest available version of a software can be installed on your system.

$ sudo apt-get update

Update package lists

Then, use the following apt-get command to install memtester.

$ sudo apt-get install memtester

Install memtester

This is the Usage of the memtester command:

$ memtester [-p physaddrbase [-d device]] <mem>[B|K|M|G] [loops]

Example:

The following command will check 200 MBs of RAM space in two iterations:

$ sudo memtester 200M 2

This is how the test output looks like.

Perform RAM test on Linux

The output indicated that I do not have any errors in my RAM. Lucky much for how roughly I sometimes use my Laptop.

There is, however, one limitation of this command: you can only scan RAM upto the size of free RAM on your system. The memtest86+ utility at boot GRUB menu is what you can use to thoroughly test your RAM.

So these were a few commands through which you could know all about the RAM installed on your Ubuntu system. You also learned how to use the memtest utility so that you can be sure that your RAM is working optimally.

How to check the installed RAM on your Ubuntu System