Find Ram Size in Linux Using free And top Commands
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 -hrn total used free shared buff/cache availablernMem: 7.7G 1.4G 4.9G 117M 1.4G 6.0GrnSwap: 0B 0B 0BIn 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:
$ toprntop - 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 zombiern%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 strnKiB Mem : 7995908 total, 1511044 free, 4699944 used, 1789920 buff/cachernKiB Swap: 0 total, 0 free, 0 used. 6061236 avail MemIn the example output above, the total RAM installed is 7995908 KiB (which is approximately 7.7 GB).
