Sometime, we may need to know the System’s RAM size to check whether it meets a software’s requirements or to find available free RAM during application
To view the total available RAM type the following command
free
Output – (displays the total available RAM in KB)
total used free shared buff/cache available
Mem: 1014488 183236 194352 5708 636900 787780
Swap: 0 0 0
To view the total available RAM in MegaBytes type the following command
free -m
Output :
total used free shared buff/cache available
Mem: 990 178 189 5 622 769
Swap: 0 0 0
To View the total available RAM in GigaBytes type the following command
free -g
also you can use the following command
sudo lshw -class memory
Output:
*-firmware
description: BIOS
vendor: Xen
physical id: 0
version: 4.2.amazon
date: 08/09/2016
size: 96KiB
capabilities: pci edd
*-memory
description: System Memory
physical id: 1000
size: 1GiB
capacity: 1GiB
*-bank
description: DIMM RAM
physical id: 0
slot: DIMM 0
size: 1GiB
width: 64 bits
You can also get complete system’s memory information by executing following command
cat /proc/meminfo
Output:
MemTotal: 1014488 kB
MemFree: 194380 kB
MemAvailable: 787840 kB
Buffers: 74544 kB
Cached: 517876 kB
SwapCached: 0 kB
Active: 448400 kB
Inactive: 304596 kB
Active(anon): 163436 kB
Inactive(anon): 5268 kB
Active(file): 284964 kB
Inactive(file): 299328 kB
Unevictable: 3660 kB
Mlocked: 3660 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 0 kB
Writeback: 0 kB
AnonPages: 164232 kB
Mapped: 42776 kB
Shmem: 5708 kB
Slab: 44512 kB
SReclaimable: 28608 kB
SUnreclaim: 15904 kB
KernelStack: 2864 kB
PageTables: 2976 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 507244 kB
Committed_AS: 798324 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
HardwareCorrupted: 0 kB
AnonHugePages: 124928 kB
CmaTotal: 0 kB
CmaFree: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 43008 kB
DirectMap2M: 1136640 kB