55
To get information about your RAM or memory on Linux, all you need is a terminal command. Find out what that is and how to use it here.
Linux: Obtaining RAM information and determining your RAM
With a simple terminal command, you can learn a lot about your RAM. Since the display is a little confusing, we will explain it to you in this guide.
- Open a terminal with the key combination [Ctrl] + [Alt] + [T] or select it from the list in your program.
- Now enter the command “top” without quotation marks and confirm with [Enter].
- A list of your current processes will appear, which also displays all information about your installed RAM in real time.
- Under “KiB Mem” you will find the total size of your RAM. Under “used” and “free,” you can also see how much RAM is currently occupied or free.
Important commands for checking RAM under Linux
Here are some important commands for checking RAM under Linux:
- free -h shows a clear summary of the total, used, and free memory, including cache and swap memory. total means that the RAM is fully available. used refers to the RAM currently in use, free refers to unused RAM, and shared refers to memory that is used by multiple processes. buff/cache refers to the memory used by the buffer and cache. available stands for memory available for new processes.
- top shows a dynamic, running, and updated list of active processes, including RAM and CPU usage. Press the M key to sort by memory consumption.
- htop is the improved counterpart to top with a colorful and interactive user interface as well as scroll and search functions; may need to be installed separately (sudo apt install htop).
- cat /proc/meminfo provides the most detailed view of memory, including different memory types and system cache.
Physical RAM data with dmidecode and swap info
Here, Linux users can find physical RAM data with dmidecode and swap info:
- dmidecode –type 17 (requires root privileges) displays detailed hardware information about your RAM, e.g., the number of slots, capacities per module, type (DDR3, DDR4), and speeds.
- Swap is a virtual swap space on the hard disk. When memory is scarce, the system stores data from RAM in swap. You can also view the swap size and usage via free or swapon -s.