方法一:
file /sbin/init 或 file /bin/ls
结果如下
[root@localhost ~]# 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@localhost ~]# 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
如果显示为 32bit 为 32 位,64bit 则为 64 位。
方法二:
[root@localhost ~]# uname -a
Linux localhost.lw 2.6.32-358.el6.i686 #1 SMP Thu Feb 21 21:50:49 UTC 2013 i686 i686 i386 GNU/Linux
显示 x86_64 表示为 64 位,i686 则为 32 位。
方法三:
[root@localhost ~]# getconf LONG_BIT
32
直接看显示结果