Home » Raspberry Pi: Get information about the RAM

Raspberry Pi: Get information about the RAM

by shedboy71

In this article we show you various command line commands to retrieve information about the memory on your Raspberry Pi

This was tested on a Raspberry Pi 4.

The command “free” provides information about the working memory:

free

When I ran this I saw this

[codesyntax lang=”bash”]

              total        used        free      shared  buff/cache   available
Mem:        1911988      173552     1407280       31544      331156     1621596
Swap:        102396           0      102396

[/codesyntax]

Total:  This field shows the total amount of memory and how much is installed on your system.

Used: This column tells how much memory is used currently by running processes. The used memory can be calculated using this formula = total – free – buffer/cache.

Free: This field represents how much memory is free or is not being used by any process.

Shared: This field represents the memory that is being shared by multiple processes.

Buffers: This field shows the amount of memory reserved by the OS kernel. The memory could be allocated further if any application needed memory,

Cached: This field tells the amount of memory that is used to store recent data and files in RAM

Available: This field represents the amount of memory available for starting a new process without memory swapping.

If you want the values in MByte right away you can run this

free -m -t

When I ran this I saw this

[codesyntax lang=”bash”]

              total        used        free      shared  buff/cache   available
Mem:           1867         170        1373          30         323        1582
Swap:            99           0          99
Total:         1967         170        1473

[/codesyntax]

Memory usage and swap behavior

Learn more about memory usage and swap behavior

cat /proc/meminfo

When I ran this I saw this

[codesyntax lang=”bash”]

MemTotal:        1911988 kB
MemFree:         1406312 kB
MemAvailable:    1620988 kB
Buffers:           60880 kB
Cached:           246708 kB
SwapCached:            0 kB
Active:           301312 kB
Inactive:         137896 kB
Active(anon):     131896 kB
Inactive(anon):    31268 kB
Active(file):     169416 kB
Inactive(file):   106628 kB
Unevictable:          16 kB
Mlocked:              16 kB
HighTotal:       1232896 kB
HighFree:         842044 kB
LowTotal:         679092 kB
LowFree:          564268 kB
SwapTotal:        102396 kB
SwapFree:         102396 kB
Dirty:                56 kB
Writeback:             0 kB
AnonPages:        131684 kB
Mapped:            99964 kB
Shmem:             31544 kB
KReclaimable:      23924 kB
Slab:              40044 kB
SReclaimable:      23924 kB
SUnreclaim:        16120 kB
KernelStack:        1736 kB
PageTables:         3616 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:     1058388 kB
Committed_AS:     935600 kB
VmallocTotal:     245760 kB
VmallocUsed:        4972 kB
VmallocChunk:          0 kB
Percpu:              464 kB
CmaTotal:         262144 kB
CmaFree:          256028 kB

[/codesyntax]

Distribution of shared memory

The following will display the available RAM for the memory of the processor and the GPU in MB

vcgencmd get_mem arm && vcgencmd get_mem gpu

When I ran this I saw this

[codesyntax lang=”bash”]

arm=948M
gpu=76M

[/codesyntax]

You may also like

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More