如何查看linux版本
一。 查看linux内核版本号的三种命令:
1. cat /proc/version 结果如下:
[root@localhost ~]# cat /proc/version
Linux version 3.10.0-123.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Mon Jun 30 12:09:22 UTC 2014
2. uname -a 结果如下:
[root@localhost ~]# cat /proc/version
Linux version 3.10.0-123.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.2 20140120 (Red Hat 4.8.2-16) (GCC) ) #1 SMP Mon Jun 30 12:09:22 UTC 2014
3. uname -r 结果如下:
[root@localhost ~]# uname -r
3.10.0-123.el7.x86_64
二。 查看linux系统版本号
1. lsb_release -a 结果如下
[root@localhost ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.0.1406 (Core)
Release: 7.0.1406
Codename: Core
这个命令适用于所有的linux,包括Redhat、SuSE、Debian等发行版。
注: 如果提示找不到上述命令,可以安装,安装命令如下:
yum install redhat-lsb -y
2. cat /etc/issue
[h5-dde@NHCNC h5hq]$ cat /etc/issue
Red Hat Enterprise Linux AS release 4 (Nahant Update 8)
Kernel \r on an \m
3. cat /etc/redhat-release
[root@localhost ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)
4. rpm -q centos-release
[root@localhost ~]# rpm -q centos-release
centos-release-7-0.1406.el7.centos.2.3.x86_64