lsb_release
命令可以查询你的linux发行版本
安装
centos
yum install redhat-lsb-core
ubuntu
sudo apt-get install lsb-core
使用
显示所有信息
lsb_release -a
结果:
LSB Version: core-9.20160110ubuntu0.2-amd64:core-9.20160110ubuntu0.2-noarch:security- 9.20160110ubuntu0.2-amd64:security-9.20160110ubuntu0.2-noarch
Distributor ID: Ubuntu
Description: Ubuntu 16.04.4 LTS
Release: 16.04
Codename: xenial
显示简短的版本信息
lsb_release -ds
结果:
Ubuntu 16.04.4 LTS