How much RAM memory on Ubuntu
This command for Ubuntu shows you the RAM memory on your server
Mark van Eijk 1 minute read Hosting
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}'
To count CPU cores too, see how many CPU cores your server has. When memory runs low, find the processes using the most or add swap space.