There are some easy way to check if your linux/unix or ubuntu OS is 32-bit or 64 bit. Of course, if you run server for magento then I highly recommend you choose OS 64 bit. Now you check follow one of these ways.

32 bit or 64 bit OS

1. dpkg to  check OS 32-bit or 64-bit

Just type these shell bash in command line
For 64 bit systems

$ dpkg --print-architecture
amd6

For 32 bit systems

$ dpkg --print-architecture
i386

2. Use simple shell script to check OS 32-bit or 64-bit

If you have a little knowledge about shell script programming, you will like to make a simple script for later use too. Here is a simple script to do that. Let ‘s make a new file checkos.sh with this text

#!/bin/bash
ARCH=$(uname -m)
if [ "$ARCH" = "i686" ]; then
zenity --info --title="Architecture Checker" --text="Your Architecture is 32-Bit"
fi
if [ "$ARCH" = "x86_64" ]; then
zenity --info --title="Architecture Checker" --text="Your Architecture is 64-Bit"
fi

Grant permission 755 for it and execute it, you will see the result something like this

32-bit-or-64-bit

 

3. Get longest bit to check 32-bit or 64-bit

Use this command line

 getconf LONG_BIT

If your OS is 64-bit then you will see somethings like this
check 32bit or 64bit in mac

As you see I check it in MAC OSX and it still work well.

4. Use OS menu

If you are using Ubuntu, you can follow the menu

System Settings -> Details

ubuntu

And you will see all of current detail of your current OS include the bit value

5. uname command to check OS 32 bit or 64 bit

Use the command like this

/bin/uname -m

If the result is i686, your OS is 32 bit, unless you will see x86_64

uname to check server 64bit or 32 bit

6. file /sbin/init

Result for 32-bit Ubuntu:

/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

whereas for the 64-bit version it would look like:

/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.15, stripped

8 thoughts on “How to check if Linux/ubuntu OS 32-bit or 64-bit

  1. I think we don’t use all of ways but we use somethings what is easiest to remember. And nothing better than this code line

    uname -m

  2. I used this way

    getconf LONG_BIT

    It work well, I think just need one way to make sure it work is enough. That ‘s all to know my OS is 32bit or 64bit. Thanks anyway 🙂

Leave a Reply