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