1. 从系统查看
1.1 uname -a 命令
[root@qs-dmm-rh2 ~]# uname -a
Linux qs-dmm-rh2 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:43 EDT 2010 i686 i686 i386 GNU/Linux
[root@qs-xezf-db2 ~]# uname -a
Linux qs-xezf-db2 2.6.18-194.el5 #1 SMP Tue Mar 16 21:52:39 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
1.2 file /bin/ls 命令
[root@qs-dmm-rh2 ~]# 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
[root@qs-xezf-db2 ~]# file /bin/ls
/bin/ls: ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped
1.3 getconf LONG_BIT 命令
[root@qs-dmm-rh2 ~]# getconf LONG_BIT
32
[root@qs-xezf-db2 ~]# getconf LONG_BIT
64
1.4 arch命令
[root@qs-dmm-rh2 ~]# arch
i686
[root@qs-xezf-db2 ~]# arch
x86_64
2. 从CPU查看
[root@qs-dmm-rh2 ~]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
0
[root@qs-xezf-db2 ~]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
8
结果大于0, 说明支持64bit计算. lm指long mode, 支持lm则是64bit。
本文介绍了通过多种命令检查Linux系统的架构与位数的方法,包括使用uname-a、file/bin/ls、getconf LONG_BIT和arch命令来从系统层面判断,以及通过查看/proc/cpuinfo文件中的lm标志来从CPU层面确认是否支持64位计算。

279

被折叠的 条评论
为什么被折叠?



