You can find the amount of RAM installed on your Linux system using the free
and top
commands.
Method 1: Using the free
command The free
command displays information about the system’s total and used memory (both RAM and swap space). To view the RAM size in kilobytes, megabytes, or gigabytes, use the -h
option to display the results in a human-readable format:
$ free -h
total used free shared buff/cache available
Mem: 7.7G 1.4G 4.9G 117M 1.4G 6.0G
Swap: 0B 0B 0B
In the example output above, the total RAM installed is 7.7 GB.
Method 2: Using the top
command The top
command shows a real-time view of the system’s processes, memory usage, and other system information. To display the total RAM installed, run the top
command and look for the line that starts with KiB Mem
:
$ top
top - 08:14:42 up 1:00, 1 user, load average: 0.00, 0.01, 0.05
Tasks: 119 total, 1 running, 118 sleeping, 0 stopped, 0 zombie
%Cpu(s): 0.3 us, 0.3 sy, 0.0 ni, 99.3 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem : 7995908 total, 1511044 free, 4699944 used, 1789920 buff/cache
KiB Swap: 0 total, 0 free, 0 used. 6061236 avail Mem
In the example output above, the total RAM installed is 7995908 KiB (which is approximately 7.7 GB).