应该有很多种方式,当前只列取通用的几种,仅供参考。
查看linux系统版本
1 (通用)
vsa6107498:~ # cat /etc/issue
Welcome to SUSE Linux Enterprise Server 12 SP1 (x86_64) - Kernel \r (\l).
2
vsa6107498:~ # cat /etc/os-release
NAME="SLES"
VERSION="12-SP1"
VERSION_ID="12.1"
PRETTY_NAME="SUSE Linux Enterprise Server 12 SP1"
ID="sles"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:suse:sles:12:sp1"
3 (只针对SUSE)
vsa6107498:~ # cat /etc/SuSE-release
SUSE Linux Enterprise Server 12 (x86_64)
VERSION = 12
PATCHLEVEL = 1
# This file is deprecated and will be removed in a future service pack or release.
# Please check /etc/os-release for details about this release.
查看linux内核版本 (通用)
1
vsa6107498:~ # cat /proc/version
Linux version 3.12.74-60.64.107-xen (geeko@buildhost) (gcc version 4.8.5 (SUSE Linux) ) #1 SMP Tue Oct 2 11:58:05 UTC 2018 (a69b414)
2
vsa6107498:~ # uname -a
Linux vsa6107498 3.12.74-60.64.107-xen #1 SMP Tue Oct 2 11:58:05 UTC 2018 (a69b414) x86_64 x86_64 x86_64 GNU/Linux
3
vsa6107498:~ # uname -r
3.12.74-60.64.107-xen