zoukankan      html  css  js  c++  java
  • 如何判断系统是32位还是64位的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 (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 (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 (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 (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位的系统,这个看起来不是很直观,呵呵。。。
  • 相关阅读:
    Valid Palindrome
    Construct Binary Tree from Inorder and Postorder Traversal
    LeetCode: LRU Cache
    LeetCode: Max Points on a Line
    LeetCode: Evaluate Reverse Polish Notation
    LeetCode:Two Sum
    LeetCode: Binary Tree Postorder Traversal
    LeetCode:Binary Tree Maximum Path Sum
    iOS开发 入门学习总结(二)Objective-C 语法特性总结
    LeetCode: Minimum Depth of Binary Tree
  • 原文地址:https://www.cnblogs.com/L-H-R-X-hehe/p/3825315.html
Copyright © 2011-2022 走看看