Linux系統查看系統是32位還是64位方法總結 in 創新實訓
這篇博客是總結、歸納查看Linux系統是32位還是64位的一些方法,很多內容來自網上網友的博客。本篇只是整理、梳理這方面的知識,方便自己忘記的時候隨時查看。
方法1:getconf LONG_BIT 查看
如下例子所示: 32位Linux系統顯示32, 64位Linux系統顯示64。最簡單、快捷的方法。
[[email protected] ~]# getconf LONG_BIT
32
[[email protected] ~]# getconf LONG_BIT
64
方法2:uname命令查看
如下例子所示,x86_64表示64位系統, i686 i386表示32位系統。i686 只是i386的一個子集,支持的cpu從Pentium 2 (686)開始,之前的型號不支持.
[[email protected] ~]# uname -a
Linux DB-Server 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[[email protected] ~]# uname -m
i686
[[email protected] ~]# uname -a
Linux gettestlnx01 3.8.13-16.2.1.el6uek.x86_64 #1 SMP Thu Nov 7 17:01:44 PST 2013 x86_64 x86_64 x86_64 GNU/Linux
[[email protected] ~]# uname -m
x86_64
方法3: arch命令查看
[[email protected] ~]# arch
i686
[[email protected] ~]# arch
x86_64
方法4: file命令查看
[[email protected] ~]# file /sbin/init
/sbin/init: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# file /bin/ls
/bin/ls: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
[[email protected] ~]# file /sbin/init
/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
[[email protected] ~]#
[[email protected] ~]#
[[email protected] ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
方法5: 此方法來自於David的博客,通過查看CPU的信息來判定Linux系統是否是64位操作系統。如果結果大於0, 說明支持64bit計算. lm指long mode, 支持lm則是64bit。
[[email protected] ~]# cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l
0
[[email protected] ~]# cat /proc/cpuinfo | grep flags | grep ‘ lm ‘ | wc -l
6
參考資料:
http://www.cnblogs.com/dingchenghong/archive/2012/06/29/2569456.html
http://blog.csdn.net/tianlesoftware/article/details/6267115
http://www.cnblogs.com/JemBai/archive/2012/05/25/2517783.html
Linux系統查看系統是32位還是64位方法總結 in 創新實訓