方法一、使用 hostnamectl 命令查看操作系统信息
[root@xxx ~]# hostnamectl
Static hostname: xxx
Icon name: computer-vm
Chassis: vm
Machine ID: 2da8dbcd2d0148c588848b987c1941d7
Boot ID: 1c816e9eb08649e78e0fef5381a625de
Virtualization: kvm
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-693.el7.x86_64
Architecture: x86-64
方法二、使用 cat /etc/os-release 命令查看操作系统信息
[root@xxx ~]# cat /etc/os-release
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"