How to Test the RAM on Linux

Techwalla may earn compensation through affiliate links in this story.
Woman looking at her computer in her office at night.
Image Credit: DragonImages/iStock/Getty Images

Faulty RAM memory can slow your computer to a crawl and cause programs to hang or close unexpectedly. The Memtester utility runs on Linux computers to stress test the memory directly from the operating system. Run the Memtester tool as a root user to properly lock the memory before carrying out the test. The utility's exit code will tell you if the memory is working properly or, if not, which portion of the test failed.


Step 1

Open a Terminal or Konsole window. You can find these programs under the main programs menu or by right-clicking the desktop.

Step 2

Type the command "which memtester" to check if the memtester utility is installed on the computer.

Step 3

Install the memtester utility from the software repository, if it is not already installed. Ubuntu and Linux Mint users type "sudo apt-get install memtester" at the command line. Fedora users type "yum install memtester" at the command line.


Step 4

Type the command "su -" to become the root user. Ubuntu and Linux Mint users type "sudo" immediately before the memtester command.

Step 5

Type the command "memtester 100 5" to test the memory. Replace "100" with the size, in megabytes, of the RAM installed on the computer. Replace "5" with the number of times you want to run the test.

Step 6

Type the command "echo $?" to show the exit code when you see a command prompt again. If the output is "0" the memory is working properly. The other possible outcomes are:


x01: Error allocating or locking memory, or invocation error x02: Error during stuck address test x04: Error during one of the other tests.

Step 7

Type the command "exit" to close the root session.


On Ubuntu systems use the Memtest86+ tool that you'll find on the Ubuntu Live CD. Boot up from the Ubuntu Live CD, press and hold the Shift key, and then select the Memory Test option.


references & resources