Linux里的lsb_release命令用来查看当前系统的发行版信 息(prints certain LSB (Linux Standard Base) and Distribution information.)。有了这个命令就可以清楚的知道到底是RedHat的、还是别的发行版,还有具体的版本号,比如3.4还是5.4等等。有些系 统上不一定安装了这个命令,可以通过查看/etc/issue文件得到发行版信息。
常用参数
格式:lsb_release
格式:lsb_release -v
查看LSB本身的版本信息。
格式:lsb_release -a
打印本系统发行版的所有信息,比如发行版的ID,描述信息,具体版本,代号。
格式:lsb_release -d -s
格式:head -1 /etc/issue
查看发行版的描述信息,后面实例二展示了这个用法。
使用示例:
示例一:
-
[root@www.linuxidc.com ~]# lsb_release
-
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
-
[root@www.linuxidc.com ~]# lsb_release -a
-
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
-
Distributor ID: RedHatEnterpriseServer
-
Description: Red Hat Enterprise Linux Server release 5.4 (Tikanga)
-
Release: 5.4
-
Codename: Tikanga
-
[root@www.linuxidc.com ~]# lsb_release -v
-
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
-
[root@www.linuxidc.com ~]# lsb_release -i
-
Distributor ID: RedHatEnterpriseServer
-
[root@www.linuxidc.com ~]# lsb_release -d
-
Description: Red Hat Enterprise Linux Server release 5.4 (Tikanga)
-
[root@www.linuxidc.com ~]# lsb_release -r
-
Release: 5.4
-
[root@www.linuxidc.com ~]# lsb_release -c
-
Codename: Tikanga
-
[root@www.linuxidc.com ~]# lsb_release -r -s
-
5.4
-
[root@www.linuxidc.com ~]# uname -a
-
Linux jfht 2.6.18-164.el5PAE #1 SMP Tue Aug 18 15:59:11 EDT 2009 i686 i686 i386 GNU/Linux
-
[root@www.linuxidc.com ~]# cat /proc/version
-
Linux version 2.6.18-164.el5PAE (mockbuild@x86-002.build.bos.RedHat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:59:11 EDT 2009
-
[root@www.linuxidc.com ~]# cat /etc/issue
-
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
-
Kernel on an m
-
[root@www.linuxidc.com ~]# cat /etc/RedHat-release
-
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
-
[root@www.linuxidc.com ~]#
示例二:
-
[root@www.linuxidc.com ~]# lsb_release -d -s
-
"Red Hat Enterprise Linux Server release 5.4 (Tikanga)"
-
[root@www.linuxidc.com ~]# head -1 /etc/issue
-
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
-
[root@www.linuxidc.com ~]#
示例三:
-
root@web186 root]# lsb_release
-
LSB Version: 1.3
-
[root@web186 root]# lsb_release -a
-
LSB Version: 1.3
-
Distributor ID: RedHatEnterpriseAS
-
Description: Red Hat Enterprise Linux AS release 3 (Taroon Update 4)
-
Release: 3
-
Codename: TaroonUpdate4
-
[root@web186 root]#