目录
1.查看Linux系统版本 命令1:lsb_release -a
该命令适用于所有Linux系统,会显示出完整的版本信息,包括Linux系统的名称,如Debian、Ubuntu、CentOS等,和对应的版本号,以及该版本的代号,例如在Debian 8中将会显示代号jessie。
[root@iZbp13nq1pxf5wki525wiuZ ~]# lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.9.2009 (Core)
Release: 7.9.2009
Codename: Core
lsb_release解析
显示发行版本信息
补充说明
LSB是Linux Standard Base的缩写linux多线程编程,lsb_release命令用来显示LSB和特定版本的相关信息。如果使用该命令时不带参数,则默认加上-v参数。
[root ~]# lsb_release --h
FSG lsb_release v2.0 prints certain LSB (Linux Standard Base) and
Distribution information.
Usage: lsb_release [OPTION]...
With no OPTION specified defaults to -v.
Options:
-v, --version
Display the version of the LSB specification against which the distribution is compliant.
-i, --id
Display the string id of the distributor.
-d, --description
Display the single line text description of the distribution.
-r, --release
Display the release number of the distribution.
-c, --codename
Display the codename according to the distribution release.
-a, --all
Display all of the above information.
-s, --short
Use short output format for information requested by other options (or version if none).
-h, --help
Display this message.
命令2:cat /etc/issue
该命令适用于所有Linux系统查看linux系统版本命令linux内核,显示的版本信息较为简略查看linux系统版本命令,只有系统名称和对应版本号。
[root ~]# cat /etc/issue
S
Kernel r on an m
命令3:cat /etc/redhat-release
该命令仅适用于Redhat系列的Linux系统,显示的版本信息也较为简略。
[root ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)