How to Check RAM Slots in Linux

You have two options when it comes to checking which RAM slots are occupied and with what on your machine. The first is to open up the case and look. This might involve unscrewing bolts on a desktop or releasing some cases this a fragile door on a laptop. Doing this on an x86 or x86_64 Linux tablet is unthinkable! Either way, this option is completely out. Fortunately, the other option is using a simple command line tool that will take almost no time at all to run.

As usual, you’ll need to open a command prompt for this. Search for the word Terminal on the Ubuntu Unity Dash or hold down Ctrl+Alt+T if you’re using the overwhelming majority of desktop environments. You may wish to click on the Applications or Whisker menu, point to System Tools and then click on Terminal if you’re using LXDE, Xfce4, Cinnamon, KDE or any of the other various platforms that support this gesture.

Method 1: Using the DMI Table Decoder

By far the easiest way to check the number of RAM slots currently in use in your machine without opening it up is to use the DMI Table Decoder command called dmidecode, which gives you a flat report. At the command prompt, type sudo dmidecode -t 16 and push enter. You’ll probably be asked for your administrator password. Type it and then push enter. You’ll get a decent amount of output telling you precisely what number of devices you have. Then again, this enumeration is based on devices and not the actual physical count. In some cases this might differ, so you’ll need to try something else.

Once you done reviewing that information, type sudo dmidecode -t 17 and push enter to receive a complete list of physical cards plugged into the RAM slots on your computer. This will also tell you if you’re using DIMM, SODIMM or some other class of RAM cards. As long as that provided you with the information you needed you can close out the window right here and finish. Two commands was all it took to get the information you were looking for, and even then with an absolute minimal amount of playing around.

Method 2: Using the List Hardware App

There’s another simple command line utility that can do the same thing, though it might give you much more of a wall of text than the previous one. The benefit is that you only have to issue a single command this time, though you might wish to scroll up or down after it gets through executing because you will receive more output than can comfortably fit on most terminal windows. Type sudo lshw -class memory and push enter. You’ll notice that unlike the others this app isn’t just completely instant. That’s because it actually polls a whole bunch of hardware devices on your system to make sure that what it reports back to you is 100 percent accurate.

More than likely, you’ll notice a few phrases flash across the screen before getting deleted. You might see SCSI and USB, which could be a bit surprising because they have absolutely nothing to do with RAM slots. Just sit back and enjoy the ride while comfortably ignoring this extraneous information. The polling could take a little bit of time on older machines, but faster CPUs can make the process almost instantaneous. You might notice some speed issues on laptops, but once again this shouldn’t cause any issues.

Now once the program finishes what it was doing, you’ll probably have quite a wall of text to sort through. Some users prefer to use grep while others prefer to simply scroll upwards. In either case, what you’re looking for are each bank of memory. For instance, the test system we ran this on returned information about four individual banks of RAM, which were each from the same vendor and featured the same clock speeds. By the way, keep the physical ID number section in mind. As with many things you’ll find in Unix systems, the Linux kernel begins counting at slot zero instead of slot one. In our test machine’s case, there were four slots that received numbers 0-3 instead of 1-4. Even if a memory card gets assigned to slot zero, that doesn’t mean that your system is ignoring it.

Each of them also come with the same bit width, which might be important on most installations. For an overwhelming majority of users, this has been more than enough information and certainly told you plenty about the type of RAM that you’re working with. You might even know enough to order replacements or to configure something for Wine. Some PC games, for instance, need to know which kind of RAM you’re working with. If you’re on a system with a ton of RAM cards, such as a Linux Web server that features a boatload of volatile memory for running virtual machines, then you might have need of grep to sort this information out. Everyone else will have solved their issue by now.

You, however, can type sudo lshw -class memory | grep size and push enter to get a quick overview. Now, on our simple test machine this wasn’t all that impressive since it only ever had four binary gigabytes of RAM divided into four different sticks. If you have something like an Xserve with 96 GB of RAM, then this quick overview might be a whole lot more useful to you.

Keep in mind that in a minority of cases, the information these apps return can be misleading so you’ll still eventually want to do a physical check of the RAM cards inside your box if you were going to plan a replacement and wanted to be absolutely certain there wasn’t anything wrong. You might even get strange unpredictable results if you were to run this sort of command inside of a virtual machine that had an emulated bank of RAM chips. Nevertheless, the information should be more than accurate enough for most uses.

Kevin Arrows
Kevin is a dynamic and self-motivated information technology professional, with a Thorough knowledge of all facets pertaining to network infrastructure design, implementation and administration. Superior record of delivering simultaneous large-scale mission critical projects on time and under budget.

Expert Tip

How to Check RAM Slots in Linux

If the issue is with your Computer or a Laptop you should try using Restoro which can scan the repositories and replace corrupt and missing files. This works in most cases, where the issue is originated due to a system corruption. You can download Restoro by clicking the Download button below.

Download Now

I'm not interested