How to check RAM size in Ubuntu terminal on Unix and Linux Systems. On this page learn to check ram size in Linux command line in gb (Gigabytes).
free Command
free displays the total amount of free and used physical and swap memory in the system, as well as the buffers and caches used by the kernel. The information is gathered by parsing /proc/meminfo.
For human-readable output (output specifically in Gigabytes):
free -h --si
This command provides output in a format that’s easy to read for human. This is very useful because RAM is usually sold in GB units.
To check the available RAM using the /proc/meminfo file; the free command, run the following command:
cat /proc/meminfo | grep MemTotal
NOTE: The output of the /proc/meminfo command shows the RAM in kilobytes (KiB). Which means you will have to convert the displayed data to GB.
The displayed columns after the execution of the free command are:
- total: Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
- used: Used memory (calculated as total – free – buffers – cache)
- free: Unused memory (MemFree and SwapFree in /proc/meminfo)
- shared: Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on kernels 2.6.32, displayed as zero if not available)
- buffers: Memory used by kernel buffers (Buffers in /proc/meminfo)
- cache: Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
- buff/cache: Sum of buffers and cache
- available: Estimation of how much memory is available for starting new applications, without swapping. Unlike the data provided by the cache or free fields, this field takes into account page cache and also that not all reclaimable memory slabs will be reclaimed due to items being in use (MemAvailable in /proc/meminfo, available on kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as free)
- -b, –bytes: Display the amount of memory in bytes.
- -k, –kilo: Display the amount of memory in kilobytes. This is the default.
- -m, –mega: Display the amount of memory in megabytes.
- -g, –giga: Display the amount of memory in gigabytes.
- –tera: Display the amount of memory in terabytes.
- -h, –human: Show all output fields automatically scaled to shortest three digit unit and display the units of print out.
Following units are used.
B = bytes
K = kilos
M = megas
G = gigas
T = teras
