Today I saw a thread talking about how to check a system is 32bit and 64bit. According to the thread, it seems there are two different concept about system bit. One is the OS the other is machine. Basically, a 32 bit machine can only run 32bit OS, but a 64bit machine can run a 32 bit OS or a 64bit OS in compatible 32bit mode. So it comes to how to check the OS and machine's bit.
According to the thread, to check machine, there are following approaches:
1. dmesg | grep -i CPU, it will display the CPU name, based on the name, it's easy to tell if it's a 32b or 64b CPU
2. cat /proc/cpuinfo, if 'flag' has lm, it means the machine support 64bit , so it's a 64bit CPU. without lm, it's a 32bit CPU. and no matter what OS it is running, this one will always tell whether CPU is a 64 bit or 32bit.
To get OS bit, we can use following approach:
1. uname -a
if it's i386, i686, it's running in 32bit mode, even if the machine is 64bit. if it's x86_64, _64 etc, it's running 64bit OS, the machine must be a 64 bit one.
2. chkconfig LONG_BIT
if it displays 32, the OS is in 32bit mode, if 64, it's 64bit mode, this is still OS mode, not machine's mode
3. file <file_name> , find a executable and issue 'file' command it will display this file is 32bit or 64bit. But this means the OS file's compilation version. If a file is 32bit, it donesn't necessary mean OS is 32 bit or machine is 32 bit.
本文介绍了如何确定计算机系统的位数,包括操作系统和机器硬件的位数。提供了多种实用的命令行方法来判断32位与64位系统,如使用dmesg、cat /proc/cpuinfo、uname -a等命令,并解释了这些命令的具体含义。
4759

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



