There are several ways to find the total amount of RAM (random access memory) on a Linux system. Here are two ways to find the RAM size using the free
and top
commands:
free
command:The free
command is a utility that displays information about the total amount of free and used memory on a system. To find the total amount of RAM on a system using the free
command, you can use the -m
flag to display the output in megabytes:
free -m
This will display the total amount of RAM on the system, as well as the amount of used and free memory. The total amount of RAM is displayed in the total
column.
For example, the output might look something like this:
total used free shared buff/cache available Mem: 7885 2796 2457 183 2631 4695 Swap: 2047 0 2047
In this example, the total amount of RAM is 7885 MB.
top
command:The top
command is a utility that displays information about the running processes on a system, including the total amount of RAM. To find the total amount of RAM on a system using the top
command, you can use the following steps:
top
command by running the following command:top
Press the M
key to sort the processes by memory usage.
Look for the line that starts with Mem:
. This line displays the total amount of RAM on the system, as well as the amount of used and free memory. The total amount of RAM is displayed in the total
column.
For example, the output might look something like this:
Mem: 7885 total, 2796 used, 2457 free, 183 buffers
In this example, the total amount of RAM is 7885 MB.
It's important to note that the free
and top
commands only display the total amount of physical RAM on the system. If your system is using virtual memory or swap space, the total amount of available memory may be larger. Consult the documentation for these commands and online resources for more information on how to use them to find the total amount of RAM on a Linux system.