1.查看linux内核版本(ubuntu、centos、redhat等)
test@test:~$ uname -a
Linux test 5.0.0-23-generic #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
test@test:~$ cat /proc/version
Linux version 5.0.0-23-generic (buildd@lgw01-amd64-030) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #24~18.04.1-Ubuntu SMP Mon Jul 29 16:12:28 UTC 2019
2.查看linux系统版本
该命令适用于所有的Linux发行版,比如RedHat系列(Centos)、Ubuntu、SUSE、Debian…等发行版,但是在debian下要安装lsb。
test@test:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionic
该命令适合用于redhat系列
[root@ceph-monitor ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)