Knowledge
How much RAM memory on Ubuntu
#Hosting
This command for Ubuntu shows you the RAM memory on your server
Published by Mark van Eijk on September 2, 2024 · 1 minute read
The easiest way to see all installed, used, free and available RAM memory on your Ubuntu server is using the free
command, we use the -h
parameter for human readable sizes:
free -h
This outputs for example:
total used free shared buff/cache available
Mem: 7.8Gi 4.9Gi 609Mi 7.0Mi 2.3Gi 2.6Gi
Swap: 2.0Gi 253Mi 1.8Gi
If you only want one of these specific numbers:
# Total memory (ex. 7.8Gi)
free -h | awk '/^Mem:/ {print $2}'
# Used memory (ex. 4.9Gi)
free -h | awk '/^Mem:/ {print $3}'
# Free memory (ex. 609Mi)
free -h | awk '/^Mem:/ {print $4}'
# Shared memory (ex. 7.0Mi)
free -h | awk '/^Mem:/ {print $5}'
# Buffers/cache memory (ex. 2.3Gi)
free -h | awk '/^Mem:/ {print $6}'
# Available memory (ex. 2.6Gi)
free -h | awk '/^Mem:/ {print $7}'
Subscribe to our newsletter
Do you want to receive regular updates with fresh and exclusive content to learn more about web development, hosting, security and performance? Subscribe now!
Related articles
How to get top processes with highest memory usage
This command for Ubuntu shows you the RAM memory on your server
How to get top processes with highest CPU usage
This command for Ubuntu shows you the RAM memory on your server