查看方法:1、使用“getconf LONG_BIT”命令;2、使用“getconf WORD_BIT”命令;3、使用“file /bin/ls”命令,如果輸出信息中出現(xiàn)“32-bit”則為32位,如果出現(xiàn)“64-bit”則為64位。
本教程操作環(huán)境:centos7系統(tǒng)、thinkpad t480電腦。
centos怎么查看系統(tǒng)是多少位的(是32位或者64位)
32位的系統(tǒng)中int類型和long類型一般都是4字節(jié),64位的系統(tǒng)中int類型還是4字節(jié)的,但是long已變成了8字節(jié)。
linux系統(tǒng)中可用”getconf WORD_BIT”和”getconf LONG_BIT”獲得word和long的位數(shù)。
64位系統(tǒng)中應(yīng)該分別得到32和64。
getconf LONG_BIT
[root@localhost ~]# getconf LONG_BIT 64
getconf WORD_BIT
[root@localhost ~]# getconf WORD_BIT 32
file /bin/ls
[root@localhost ~]# 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
可以看到 ELF 64-bit LSB
所以該系統(tǒng)為64位
推薦:《centos使用教程》