如何判断linux是32位还是64位?

方法一:getconf LONG_BIT
如果是32b则输出32,64b则输出64

[root@centos fation]# getconf LONG_BIT
32

方法二:uname -a

执行后的结果中输出了x86_64,说明该机器是64位的,否则代表该机器是32位的

[root@centos fation]# uname -a
Linux centos 2.6.32-573.el6.i686 #1 SMP Thu Jul 23 12:37:35 UTC 2015 i686 i686 i386 GNU/Linux

方法三:file /sbin/init 或者 file /bin/ls
从结果中很容易看出

[root@centos fation]# file /sbin/init
/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

[root@centos fation]# file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

你可能感兴趣的:(linux)