How Do You Find the Number of Processors or the Amount of RAM on a Linux Server?

Problem scenario
You want to know the number of processors your Linux server has.  What do you do?

Solution #1
Run this command:  grep -c ^processor /proc/cpuinfo

Solution #2
Run this command: nproc


Problem scenario
You want to know how much memory your Linux server has.  How do you find the amount of RAM (in gigabytes) on a Linux server?

Solution
Run this command:  free -g | grep Mem | awk '{print $2}'

For megabytes, run this command:  free -m | grep Mem | awk '{print $2}'

Leave a comment

Your email address will not be published. Required fields are marked *