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

4 Answers 4


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.

  • 51
    It's worth noting: free -h --si produces human readable output, in SI units of MB, GB, etc.
    – Jollywatt
    Feb 12, 2020 at 22:27
  • 2
    free -h will output it in human-readable output (usually GiB: Gibibytes--base 1024). But, since RAM is usually sold in GB (Gigabytes--base 1000), NOT GiB (Gibibytes), free -h --si is usually better, as @Jollywatt says, to output it in Gigabytes instead. Dec 14, 2021 at 8:16

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

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


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
  • 27
    free -h seems most helpful to me. "all output fields automatically scaled to shortest three digit unit"
    – craq
    Aug 4, 2019 at 23:19

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.

  • 8
    I'm going to upvote this just for the "sudo lshw -c memory" part, which is exactly what I needed..
    – Cranky
    Nov 21, 2018 at 19:54
  • 1
    lshw -c memory FTW! run as root in RHEL 7.9 is states each installed ram dimm manufacturer (i.e. samsung) and serial number and dimm slot and clock speed and size in GiB.
    – ron
    Apr 15, 2021 at 13:58
  • the sudo for lshw is super important - otherwise you'll NOT get the actual physical state, the command warns you if you don't run it as superuser, but it's easy to overlook :-)
    – jave.web
    Dec 12, 2021 at 21:37

Physical memory available in MiB:

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.

  • With 1024 seems to be a mebibyte (MiB), no MB. Jan 22, 2019 at 2:32
  • Upvoting for the grep MemTotal /proc/meminfo, which works great via ssh.
    – Artif3x
    Oct 12, 2022 at 19:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .