Linux 发行版 (Linux distribution) 是由 Linux 内核 (Linux kernal) 和 软件包管理系统组合而成的操作系统.
一, 查看 Linux 内核版(2 种方法):
- cat /proc/version
- [root@localhost ~]# cat /proc/version
- Linux version 3.10.0-957.21.3.el7.x86_64 (mockbuild@kbuilder.bsys.CentOS.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Tue Jun 18 16:35:19 UTC 2019
- uname -a
- [root@localhost ~]# uname -a
- Linux localhost 3.10.0-957.21.3.el7.x86_64 #1 SMP Tue Jun 18 16:35:19 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
二, 查看 Linux 系统版(5 种方法)
lsb_release -a , 适用于所有的 Linux 发行版, 包括 RedHat,SuSE,Debian... 等发行版
- [root@localhost ~]# lsb_release -a
- LSB Version: :core-4.1-amd64:core-4.1-noarch
- Distributor ID: CentOS
- Description: CentOS Linux release 7.6.1810 (Core)
- Release: 7.6.1810
- Codename: Core
cat /etc/RedHat-release, 这种方法只适合 RedHat 系的 Linux:
- [root@localhost ~]# cat /etc/RedHat-release
- CentOS Linux release 7.6.1810 (Core)
cat /etc/debian_version , 只适用用 Debian 系.
cat /etc/lsb-release , 适用于 Ubuntu 系.
cat /etc/issue, 适用于 Ubuntu 系.
参考资料
How do I know what kernel or distro of Linux I have? https://www.computerhope.com/issues/ch001106.htm
来源: http://www.mzh.ren/linux-version.html