what would be a command to run in different distros?
|
"uname -m" is the command you're looking for. You can run both 32bit and 64bit on modern intel and AMD processors, so "uname -p" is not going to help you (in addition it mostly doesn't work these days, this here core2 thinks the response to "uname -p" is "unknown"). Looking for existence of /usr/lib64 (as has been suggested) is not going to help you either, since some hardware and system related packages will install both 32bit and 64bit libraries to be on the safe side. On my (debian) system the fakeroot package does just that. As for the output of "uname -m", if it's i386 or i686 it's 32bit, if it's x86_64 (or alpha, or ia64 or some other 64bit architecture I've never seen :) it's 64bit. (as a fun aside, my 64bit FreeBSD server returns "amd64", which might be a bit strange for an intel quadcore but totally understandable if you know the history of the x86 64bit architecture) |
|||||
|
|
uname -a and look for x86_64. If you want to know if your CPU can handle 64bit, cat /proc/cpuinfo and look for lm within the flags. |
|||||
|
|
for RedHat/CentOS:
32-bit
64-bit
|
|||
|
|
|
Just to confuse things, you can run a 64bit kernel with a 32bit userland, which is what I'm doing. In this case, So once you check uname, you need to look for Another useful piece of information is the output of |
|||
|
|
|
Another way to do it is to ask perl what compiler said the size of a long integer is:
vs.
Or, if you've got gcc installed, the same in C:
vs.
:-) |
|||||||||||
|
|
As a duplicate of : Linux + how to verify linux version 32 Bit or 64 Bit uname -m will only give you the running 'arch'/architecture of the kernel. It will NOT tell you if your are running a 32 bits GNU/Linux distribution on a 64bits capable CPU. To know your CPU capability:
The 'LM' flag should be present in 64bits systems as it represent 'LONG MODE' (64bit Extensions, AMD’s AMD64 or Intel’s EM64T). |
|||
|
|
|
|||||||||
|
|
If you have /usr/lib64 you're running x86_64.. |
|||||
|
|
Brad Gilbert's command had a perl bug. I've fixed it and the below command works: cat /proc/cpuinfo | grep ^flags | perl -e '$=<>;print ($?"x86_64\n":"not x86_64\n")' |
|||
|
|