如何判斷系統是32位還是64位的linux系統

來源:互聯網
上載者:User

標籤:color   檔案   os   art   for   linux   

如何判斷系統是32位還是64位的linux系統

 

某日,需要下載個安裝包,忽然忘記了自己的系統是32位還是64位的系統了,一時想不起來怎麼查看時32位還是64位,呵呵,隨便百度下,就發現有好多方法,這裡記錄下,方便日後查詢:

第一種:

1
2
3
4
5
[root@CentOS62 ~]# uname -m
i686

[root@436704 ~]# uname -m
x86_64

第二種:

1
2
3
4
5
[root@CentOS62 ~]# file /sbin/init
/sbin/init: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

[root@436704 ~]# file /sbin/init
/sbin/init: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

 

第三種:

1
2
3
4
5
[root@CentOS62 ~]# file /bin/cat
/bin/cat: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

[root@436704 ~]# file /bin/cat
/bin/cat: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped

第四種方法:

1
2
3
4
5
6
7
[root@436704 ~]# echo $HOSTTYPE
x86_64

[root@CentOS62 ~]# echo $HOSTTYPE
i386

 

嘿嘿,上面的方法都是很簡單的吧,一看就知道了

其實還有一種最簡單的方法,就是看有沒有lib64這個檔案夾,凡是64位的系統必然有lib64這個檔案夾,呵呵,最後還有一種方法,看上去不是很直觀,也介紹下吧:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@436704 ~]# getconf LONG_BIT
64
[root@436704 ~]# getconf WORD_BIT
32

上面的是64位的系統

----------------------------------------

[root@CentOS62 ~]# getconf LONG_BIT
32
[root@CentOS62 ~]# getconf WORD_BIT
32

上面的是32位的系統,這個看起來不是很直觀,呵呵。。。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.