"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)
Just to confuse things, you can run a 64bit kernel with a 32bit userland, which is what I'm doing. In this case, uname -m returns x86_64 but I don't have any 64bit libraries installed so most 64bit programs won't run.
So once you check uname, you need to look for /lib64/ld-linux-x86-64.so.2, /lib64/libc-2.7.so and /lib/ld-linux.so.2, /lib/libc-2.7.so to see whether 64bit and 32bit libraries are available. And to really make sure, run those files and see if they execute correctly.
Another useful piece of information is the output of lsb_release -a which is cross-distro and will report what architecture-specific LSB modules are available.
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:
cat /proc/cpuinfo
The 'LM' flag should be present in 64bits systems as it represent 'LONG MODE' (64bit Extensions, AMD’s AMD64 or Intel’s EM64T).
"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,
uname -m
returnsx86_64
but I don't have any 64bit libraries installed so most 64bit programs won't run.So once you check uname, you need to look for
/lib64/ld-linux-x86-64.so.2
,/lib64/libc-2.7.so
and/lib/ld-linux.so.2
,/lib/libc-2.7.so
to see whether 64bit and 32bit libraries are available. And to really make sure, run those files and see if they execute correctly.Another useful piece of information is the output of
lsb_release -a
which is cross-distro and will report what architecture-specific LSB modules are available.$> getconf LONG_BIT
Answer: 32 or 64.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")'