Linux查看主机信息

这篇包括(系统版本、内核信息、核心数、主机名)还有一个关于系统信息查看的,–>飞机票

查看主机版本信息

  • 系统信息

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    [root@localhost ~]# cat /etc/redhat-release
    CentOS release 6.7 (Final)
    #or
    [root@localhost ~]# cat /etc/issue
    CentOS release 6.7 (Final)
    Kernel \r on an \m
    #or
    [root@localhost ~]# lsb_release -a
    LSB Version: :base-4.0-ia32:base-4.0-noarch:core-4.0-ia32:core-4.0-noarch
    Distributor ID: CentOS
    Description: CentOS release 6.7 (Final)
    Release: 6.7
    Codename: Final
    #yum provides */lsb_release
    #yum install -y redhat-lsb-core-4.0-7.el6.centos.i686
  • 内核信息

    1
    2
    3
    4
    5
    6
    7
    8
    [root@localhost ~]# cat /proc/version
    Linux version 2.6.32-573.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-16) (GCC) ) #1 SMP Thu Jul 23 15:44:03 UTC 2015
    #or
    [root@localhost ~]# uname -a
    Linux localhost.localdomain 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    #or
    [root@localhost ~]# uname -r
    2.6.32-573.el6.x86_64
  • 查看当前运行环境是32还是64,是32也不代表不支持64

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    [root@localhost ~]# getconf LONG_BIT
    64
    #or
    [root@localhost ~]# 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
    [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
    #or
    [root@localhost ~]# uname -a
    Linux localhost.localdomain 2.6.32-573.el6.x86_64 #1 SMP Thu Jul 23 15:44:03 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
    [root@localhost ~]# uname -m
    x86_64
    #or
    [root@localhost ~]# arch
    x86_64
    #or
    [root@localhost ~]# echo $HOSTTYPE
    x86_64
    #or
    [root@localhost ~]# getconf -a
    #or
    [root@localhost ~]# more /proc/cpuinfo

查看其他

  • 查看cpu核心数
    1
    cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c

以上