命令lsb_release



在编码时,因某些原因,可能代码要获取系统内核版本信息或依赖系统版本,这时可以利用lsb_release命令来获取系统内核版本相关信息

格式lsb_release [OPTION]...
功能:显示当前系统版本信息。
参数[option]
-v,--version
显示系统兼容的LSB规范版本号,如果不带任何参数,默认-v
-d, --description
显示当前系统的版本
-r, --release
显示系统版本号
-c, --codename
显示系统研发代号
-a, --all
上述所有的信息都会显示
-s, --short
以精简格式来显示信息,默认输出精简LSB规范版本号信息  
-h, --help
显示帮助信息    
实例:

[root test]# lsb_release
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
[root test]# lsb_release -v
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
[root test]# lsb_release -i
Distributor ID: CentOS
[root test]# lsb_release -d
Description: CentOS release 6.5 (Final)
[root test]# lsb_release -r
Release: 6.5
[root test]# lsb_release -c
Codename: Final
[root test]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.5 (Final)
Release: 6.5
Codename: Final
[root test]# lsb_release -s
:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
[root test]# lsb_release -as
:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch CentOS "CentOS release 6.5 (Final)" 6.5 Final
[root test]# lsb_release -h
FSG lsb_release v2.0 prints certain LSB (Linux Standard Base) and
Distribution information.


你可能感兴趣的:(linux命令)