How do I know if I am running 32 or 64-bit Linux?
Solution 1:
"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)
Solution 2:
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.
Solution 3:
for RedHat/CentOS:
$ uname -a
Linux cs-centos 2.6.18-92.1.22.el5 #1 SMP Tue Dec 16 12:03:43 EST 2008 i686 athlon i386 GNU/Linux
32-bit
- i686 and/or i386
64-bit
- would have x86_64 in uname -a output
Solution 4:
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.
Solution 5:
$> getconf LONG_BIT
Answer: 32 or 64.