目录
- 方式一:`cat /proc/version`
- 方式二:`uname -a`
- 方式三:`cat /etc/os-release`
- 方式四:`cat /etc/redhat-release`
- 方式五:`hostnamectl`
方式一:cat /proc/version
$ cat /proc/version Linux version 4.19.76-linuxkit (root@4abe09437d05) (gcc version 8.3.0 (Alpine 8.3.0)) #1 SMP Tue May 26 11:42:35 UTC 2020
方式二:uname -a
$ uname -a Linux 619fe68308c7 4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
方式三:cat /etc/os-release
$ cat /etc/os-release NAME="CentOS Linux" VERSION="8" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="8" PLATFORM_ID="platform:el8" PRETTY_NAME="CentOS Linux 8" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:8" HOME_URL="https://centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-8" CENTOS_MANTISBT_PROJECT_VERSION="8"
方式四:cat /etc/redhat-release
$ cat /etc/redhat-release CentOS Linux release 8.5.2111
方式五:hostnamectl
$ hostnamectl Static hostname: 619fe68308c7 Icon name: computer-vm Chassis: vm Machine ID: ce70cdd97ef44e4581868b3fa70bb8f9 Boot ID: c44736cb290f47db9d27a2ae890e42ed Virtualization: bhyve Operating System: CentOS Linux 8 CPE OS Name: cpe:/o:centos:centos:8 Kernel: Linux 4.19.76-linuxkit Architecture: x86-64
参考