如何判斷linux是32位還是64位?
阿新 • • 發佈:2019-01-03
方法一: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