Sep
10
2012
How to determine if you are running a 32bit or a 64bit distro

This is one of the most idiotic questions i am reading all the time on the web (linux related).

So lets take the most frequent answer on this:


file /bin/ls

If the result is 32 then you are using a 32bit distro.
If the result is 64 then you are using a 64bit distro.

SO ?

I ‘ve already knew that cause i installed a 32bit linux on my machine !
It’s obvious !

When people asking this question at 99,9999% of the times, they want to know if their machine has 64bit capabilities.
And at that point you have to give them a hint, that they have to look on their CPU flags.

I’ve comment on a blog (ubuntu related) that this isnt the right way cause you can install a 32bit distro on a 64bit CPU and if you are using file linux command you cant understand if your CPU is 64bit !

They immediately removed my comment (wat?)

My comment had an extra tip :

If the below command has output


grep ^flags /proc/cpuinfo | grep ' lm '

or in one line:


grep -E '^flags.* lm .*'  /proc/cpuinfo

then your cpu has Long Mode (x86-64) capabilities.

The definition of flags are in cpufeature.h
and can be found online here:

cpufeature

One other way is to search online the model name of your cpu. The model name can be also located in /proc/cpuinfo

  1. Avatar di serverhorror serverhorror

    Monday, September 10, 2012 - 11:36:52

    Hi,

    what about “uname -m”, “uname -i”, “arch” ?

    Won’t that do?

  2. Avatar di ebal ebal

    Monday, September 10, 2012 - 12:30:53

    Nope,

    cause that will tell you what version of the linux kernel you have installed.

    Its the same thing, using file linux command and not the CPU capabilities.