RAM, short for Random Access Memory, can be thought of as the working area 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 for you to work on. When you save the file, your system copies it to more stable, non-volatile storage hardware called read-only memory. Not only that, when you run a program, your operating system and memory are the medium it runs on. If you are looking for a powerful computer system, a good balance between big enough and fast memory is your answer.
When using Debian, we come across many scenarios in which RAM plays a large role. We want to know how much RAM is installed on our system, how much of it we can use, our RAM is error-free and much more.
In this article we explain the following things you can do with your installed RAM from the Debian 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 ran the commands and procedures mentioned in this article on a Debian 10 Buster system.
Note: We will be using the Debian command line, the Terminal, to explain the above tasks. You can open the Terminal application by pressing the Super (Windows) key and looking for it through the Application Launcher as follows:
How to check the installed, used and available RAM
The easiest way to check your Debian’s memory stats is with the free command:
How to use the free command:
This command is used to check the memory and swap usage on your system in a few lines. Without using a switch, the displayed output is printed in kilobytes.
A better approach, however, is to use the -h switch to have the free command display memory and swap usage in the closest possible 3-digit format.
$ free -h
The “Mem” part of the output gives you information about the memory of your system. The “Total” column gives you the total number of GB of RAM installed on your system. The Used and Available columns indicate the amount of memory or GBs that your system is using.display
How to check the type and speed of RAM
Before explaining how to check the type and speed of your RAM, let’s first define what both mean:
- Type: RAM comes in many profiles these days based on data and transfer rates. These include the older SDRAM (Synchronous Dynamic RAM), 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 the RAM in MHz or GHz, we think of the clock cycles. A cycle means a single reading and writing session. The speed of the RAM indicates how many cycles per second it can run. A 3200 MHz RAM can perform 3200 cycles (read / write sessions) in one second
You can use the following command as sudo to check the type of your RAM
$ sudo dmidecode --type memory | less
The system asks you for the sudo password and then displays the following information:
Scroll down and find the type of RAM in the output as highlighted above. As you can see I have DDR3 installed on my laptop.
You can also view the clock speed of your RAM using the same command:
The above output shows that my system has 1333 MHz of RAM installed.
You can exit this output with the ‘q’ key.
How to test the RAM for errors using the MemTester utility
Since RAM is a fragile device, semiconductors can be damaged. This can affect the performance of all of your memory. You can use the MemTester to test your RAM for errors.
To install this utility, open your Terminal application and enter the following command to first update your system’s repository index with that of the internet repositories. This ensures that the latest available version of software can be installed on your system.
$ sudo apt-get update
Then use the following apt-get command to install memtester.
$ sudo apt-get install memtester
This is how to use the memtester command:
$ Member [-p physaddrbase [-d device]]
The following command checks 200MB of RAM space in two iterations:
$ sudo memtester 200M 2
This is what the test output looks like.
The output indicated that I have no errors in my RAM. Luckily how roughly I use my laptop sometimes.
However, there is one limitation to this command: you can only scan memory up to the amount of free memory on your system. The memtest86 + utility in the boot GRUB menu is what you can use to thoroughly test your memory.
So, these were some commands that you could use to learn all about the RAM installed on your Debian system. You also learned how to use the memtest utility so you can be sure that your RAM is working at its best.