查看 Linux 版本信息

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/henryhu712/article/details/83035194

hostnamectl,查看 CentOS 版本信息:

 # hostnamectl
   Static hostname: VM_0_5_centos
         Icon name: computer-vm
           Chassis: vm
        Machine ID: f9d400c5e1e8c3a8209e990d887d4ac1
           Boot ID: 80e70d399f544e298e960fc5dc648ad9
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.26.2.el7.x86_64
      Architecture: x86-64

使用 *release,查看 CentOS 信息:

# cat /etc/*elease
CentOS Linux release 7.5.1804 (Core) 
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.5.1804 (Core) 
CentOS Linux release 7.5.1804 (Core)

hostnamectl,查看 Ubuntu 版本信息:

$ hostnamectl
   Static hostname: hu-Zhaoyang-E49L
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: 7107ebba365f4416a873803ccc4474b3
           Boot ID: 894294a9382b4a9ab6ca802f4dcc02f4
  Operating System: Ubuntu 16.04.5 LTS
            Kernel: Linux 4.15.0-36-generic
      Architecture: x86-64

使用 *release,查看 Ubuntu 信息:

$ cat /etc/*elease
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.5 LTS"
NAME="Ubuntu"
VERSION="16.04.5 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.5 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

猜你喜欢

转载自blog.csdn.net/henryhu712/article/details/83035194