Problem scenario
You want to find the total RAM a Linux server has. You do not want the number to be in kilobytes. You want human-readable output. What do you do?
Solution
Run this command:
free -g | grep Mem | awk '{print $2 " gigabytes of RAM total (sum of in use and available combined)"}'
If the amount of GB is less than 0.5, the result of the above command will show as 0 GB of memory. In that case, you can find out how many megabytes of memory the server has with this command:
free -m | grep Mem | awk '{print $2 " megabytes of RAM total (sum of in use and available combined)"}'