0%

[转] Linux 查看系统内核版本和发行版本

一、查看 Linux 内核版本命令

以下两条命令适合所有 Linux 系统。

1、cat /proc/version

1
2
3
4
5
$ cat /proc/version
Linux version 3.10.0-327.el7.x86_64 (builder@kbuilder.dev.centos.org) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Thu Nov 19 22:10:57 UTC 2015

➜ ~ cat /proc/version
Linux version 4.4.0-36-generic (buildd@lcy01-01) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2) ) #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016

2、uname -a

1
2
3
4
5
$ uname -a
Linux centos 3.10.0-327.el7.x86_64 #1 SMP Thu Nov 19 22:10:57 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

➜ ~ uname -a
Linux www 4.4.0-36-generic #55-Ubuntu SMP Thu Aug 11 18:01:55 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

二、查看 Linux 系统版本的命令

1、lsb_release -a

1
2
3
4
5
6
7
8
9
10
11
12
13
$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.2.1511 (Core)
Release: 7.2.1511
Codename: Core

➜ ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

这个命令适用于所有的 Linux 发行版,包括 RedhatSuSEDebian… 等发行版。

有的系统中默认并没有安装 lsb_release,需要安装。下面介绍一下 CentOS 系统中安装方法。

首先查找 lsb_release 安装包:

1
2
3
4
5
6
7
8
9
10
$ yum provides lsb_release
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
redhat-lsb-core-4.1-27.el7.centos.1.i686 : LSB Core module support
源 :base
匹配来源:
文件名 :/usr/bin/lsb_release

安装:

1
$ sudo yum install -y redhat-lsb-core

2、cat /etc/redhat-release

这种方法只适合查看 Redhat 系的 Linux,如:CentOS

1
2
$ cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)

3、cat /etc/issue

此命令适用于所有的 Linux 发行版。

1
2
➜  ~ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l
欣赏此文?求鼓励,求支持!
Title - Artist
0:00