lsb_release命令用来查看当前系统的发行版信息(prints certain LSB (Linux Standard Base) and Distribution information.)。有了这个命令就可以清楚的知道到底是RedHat的、还是别的发行版,还有具体的版本号,比如3.4还是5.4等等。有些系统上不一定安装了这个命令,可以通过查看/etc/issue文件得到发行版信息。
[root@localhost linux-3.18.26]# cat /etc/issue
CentOS release 6.6 (Final)
Kernel \r on an \m
但一般这个命令用习惯了,如果没有我们可以安装一下。具体步骤如下:
1)查找哪个源包含这个命令
[root@localhost linux-3.18.26]# yum provides */lsb_release
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
redhat-lsb-core-4.0-7.el6.centos.x86_64 : LSB base libraries support for CentOS
Repo : ustack_custom_products
Matched from:
Filename : /usr/bin/lsb_release
2)从上面的输出可以看到redhat-lsb-core-4.0-7.el6.centos.x86_64这个package包含这个命令,那就安装这个包。
64ot@localhost linux-3.18.26]# yum install redhat-lsb-core-4.0-7.el6.centos.x86_
Loaded plugins: fastestmirror
Setting up Install Process
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package redhat-lsb-core.x86_64 0:4.0-7.el6.centos will be installed
--> Processing Dependency: perl-Test-Simple for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: perl-Test-Harness for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: perl-ExtUtils-MakeMaker for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: perl-CGI for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/time for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/pax for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/patch for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/msgfmt for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/man for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/batch for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /usr/bin/at for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Processing Dependency: /bin/mailx for package: redhat-lsb-core-4.0-7.el6.centos.x86_64
--> Process