To find out how much RAM you have installed on your Linux system, you can use command-line tools. The most detailed method, as mentioned in the reference, involves the lshw
command.
Using lshw
to Check RAM
The most comprehensive way to see the total amount of physical RAM installed, along with details about each memory module, is by using the lshw
command.
You need elevated privileges to run this command, so you'll typically use sudo
:
sudo lshw -c memory
This command specifically filters the hardware list (lshw
) to show only components classified as memory
. The output will provide details about your system's memory configuration, including:
- Total size: The cumulative size of all installed RAM.
- Individual banks: Information about each RAM stick (slot) installed, such as its size, type (e.g., DDR4), speed, and manufacturer (if available).
As the reference states, this command will show you "each individual bank of RAM you have installed, as well as the total size for the System Memory."
Example lshw -c memory
Output
The exact output varies depending on your hardware, but it generally looks like this:
*-memory
description: System Memory
physical id: a
logical name: system-memory
capacity: 32GiB
*-bank:0
description: DIMM DDR4 Synchronous 2400 MHz (0.4 ns)
product: HMA81GU6AFR8N-UH
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 0
serial: 00000000
slot: ChannelA-DIMM0
size: 8GiB
width: 64 bits
clock: 2400MHz (0.4 ns)
*-bank:1
description: DIMM DDR4 Synchronous 2400 MHz (0.4 ns)
product: HMA81GU6AFR8N-UH
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 1
serial: 00000000
slot: ChannelA-DIMM1
size: 8GiB
width: 64 bits
clock: 2400MHz (0.4 ns)
*-bank:2
description: DIMM DDR4 Synchronous 2400 MHz (0.4 ns)
product: HMA81GU6AFR8N-UH
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 2
serial: 00000000
slot: ChannelB-DIMM0
size: 8GiB
width: 64 bits
clock: 2400MHz (0.4 ns)
*-bank:3
description: DIMM DDR4 Synchronous 2400 MHz (0.4 ns)
product: HMA81GU6AFR8N-UH
vendor: Hynix Semiconductor (Hyundai Electronics)
physical id: 3
serial: 00000000
slot: ChannelB-DIMM1
size: 8GiB
width: 64 bits
clock: 2400MHz (0.4 ns)
In this example, the *-memory
section shows a capacity
of 32GiB, indicating the total RAM. The *-bank
sections detail four 8GiB memory sticks.
Alternative Methods
While lshw
provides detailed hardware information, simpler commands can quickly show total and available memory.
Using free
The free
command displays the total amount of free and used physical and swap memory in the system. The -h
flag makes the output human-readable (e.g., using MB, GB).
free -h
The output includes the total
column, which shows your installed RAM.
Using /proc/meminfo
Linux systems expose system information through the /proc
filesystem. The meminfo
file contains detailed memory statistics.
cat /proc/meminfo
Look for the MemTotal
line in the output.
Summary of Commands
Command | Provides | Detail Level | Requires sudo |
---|---|---|---|
sudo lshw -c memory |
Total RAM & details per module (bank) | High | Yes |
free -h |
Total, Used, Free, Cached RAM summary | Medium | No |
cat /proc/meminfo |
Detailed memory statistics (incl. Total) | High | No |
Using sudo lshw -c memory
is the recommended method from the reference to get a detailed view including individual RAM sticks and the overall total.