如何确定给定的Linux是32位还是64位? [英] How to determine whether a given Linux is 32 bit or 64 bit?
问题描述
当我键入uname -a
时,它将给出以下输出.
When I type uname -a
, it gives the following output.
Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux
如何从中得知给定的操作系统是32位还是64位?
How can I know from this that the given OS is 32 or 64 bit?
这在编写configure
脚本时很有用,例如:我要为哪种体系结构构建?
This is useful when writing configure
scripts, for example: what architecture am I building for?
推荐答案
尝试 uname -m
.缺少uname --machine
并输出:
x86_64 ==> 64-bit kernel
i686 ==> 32-bit kernel
否则,不是Linux内核,而是CPU ,请输入:
Otherwise, not for the Linux kernel, but for the CPU, you type:
cat /proc/cpuinfo
或:
grep flags /proc/cpuinfo
在标志"参数下,您将看到各种值:请参阅"/proc/cpuinfo中的标志是什么意思?一个>"
其中一个名为lm
:Long Mode
( x86-64 :amd64 ,也称为Intel 64,即支持64位)
Under "flags" parameter, you will see various values: see "What do the flags in /proc/cpuinfo mean?"
Among them, one is named lm
: Long Mode
(x86-64: amd64, also known as Intel 64, i.e. 64-bit capable)
lm ==> 64-bit processor
或使用lshw
(如萨克森州罗夫堡)) ,而没有sudo
(仅用于gpu处理cpu宽度):
Or using lshw
(as mentioned below by Rolf of Saxony), without sudo
(just for grepping the cpu width):
lshw -class cpu|grep "^ width"|uniq|awk '{print $2}'
注意:您可以安装具有32位内核的64位CPU .
(如 ysdx 在 /她自己的答案,现在,系统可以是 multiarch ,所以这毫无意义.您可能想找到编译器的默认目标")
Note: you can have a 64-bit CPU with a 32-bit kernel installed.
(as ysdx mentions in his/her own answer, "Nowadays, a system can be multiarch so it does not make sense anyway. You might want to find the default target of the compiler")
这篇关于如何确定给定的Linux是32位还是64位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!