Is it a 32bit or 64 bit system?

本文介绍了如何确定计算机系统的位数,包括操作系统和机器硬件的位数。提供了多种实用的命令行方法来判断32位与64位系统,如使用dmesg、cat /proc/cpuinfo、uname -a等命令,并解释了这些命令的具体含义。

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.

 

 

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值