How Do You Tell If You Have a 32 Bit Version of Linux or 64 Bit Version of Linux?

Problem scenario
You want to install Docker on Linux.  But you need a 64 bit version of Linux.  How do you determine if your operating system is 32 bit or 64 bit?

Solution
Run this script:

#!/bin/bash
os=$(uname -m | grep -i x)
if [ -z "$os" ];
then
  echo "The OS is 32 bit.  It will not work for Docker."
else
  echo "The OS is 64 bit"
fi

Leave a comment

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