95

What is the command to find the RAM size in computer? I want to see result in MB.

109

From a terminal you should be able to use:

free -m

From man page:

-m, --mebi Display the amount of memory in mebibytes.

--mega Display the amount of memory in megabytes. Implies --si.

Note: A kilobyte (kB) is 1000 Bytes.

73

Open a terminal (CTRL + ALT + T)...

Run following command to see RAM information in KB (1 KB is equal to 1024 bytes).

free

Run following command to see RAM information in MB (1 MB is equal to 1024 KB).

free -m

Run following command to see RAM information in GB (1 GB is equal to 1024 MB).

free -g

Or you can run following command to see more information about the same:

free -h
  • 3
    free -h seems most helpful to me. "all output fields automatically scaled to shortest three digit unit" – craq Aug 4 '19 at 23:19
18

Click on the power/gear icon (System Menu) in the top right corner of the screen and choose About This Computer. You will see the total available memory in GiB. Multiply the value by 1024 to get the size in MiB.

This value (and the value shown as Total in output of free -m on the console), is total physical RAM size, minus the amount assigned to the internal GPU, if your computer has one.

To see the total amount of physical RAM installed, you can run sudo lshw -c memory which will show you each individual bank of RAM you have installed, as well as the total size for the System Memory. This will likely presented as GiB value, which you can again multiply by 1024 to get the MiB value.

  • 1
    I'm going to upvote this just for the "sudo lshw -c memory" part, which is exactly what I needed.. – Cranky Nov 21 '18 at 19:54
14

Physical memory available in MB:

echo $(($(getconf _PHYS_PAGES) * $(getconf PAGE_SIZE) / (1024 * 1024)))

Virtual memory available in MB:

echo $(($(getconf _AVPHYS_PAGES) * $(getconf PAGE_SIZE) / (1024 * 1024)))

..or use /proc/meminfo:

grep MemTotal /proc/meminfo | awk '{print $2 / 1024}'

To see the physical chip information, you can use dmidecode to extract the DMI type 17 (Memory Device) tagged information:

sudo dmidecode -t 17

this informs you about all the memory devices installed, including the type, speed, manufacturer, form factor and a lot more besides. Yo also have sudo dmidecode -t memory which give a little bit more information.

Not the answer you're looking for? Browse other questions tagged or ask your own question.