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
查看发行版的描述信息,后面实例二展示了这个用法。
使用示例:
示例一:
- [[email protected] ~]# lsb_release
- LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
- [[email protected] ~]# 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
- [[email protected] ~]# lsb_release -v
- LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
- [[email protected] ~]# lsb_release -i
- Distributor ID: RedHatEnterpriseServer
- [[email protected] ~]# lsb_release -d
- Description: Red Hat Enterprise Linux Server release 5.4 (Tikanga)
- [[email protected] ~]# lsb_release -r
- Release: 5.4
- [[email protected] ~]# lsb_release -c
- Codename: Tikanga
- [[email protected] ~]# lsb_release -r -s
- 5.4
- [[email protected] ~]# uname -a
- Linux jfht 2.6.18-164.el5PAE #1 SMP Tue Aug 18 15:59:11 EDT 2009 i686 i686 i386 GNU/Linux
- [[email protected] ~]# cat /proc/version
- Linux version 2.6.18-164.el5PAE ([email protected]) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)) #1 SMP Tue Aug 18 15:59:11 EDT 2009
- [[email protected] ~]# cat /etc/issue
- Red Hat Enterprise Linux Server release 5.4 (Tikanga)
- Kernel \r on an \m
- [[email protected] ~]# cat /etc/RedHat-release
- Red Hat Enterprise Linux Server release 5.4 (Tikanga)
- [[email protected] ~]#
示例二:
- [[email protected] ~]# lsb_release -d -s
- "Red Hat Enterprise Linux Server release 5.4 (Tikanga)"
- [[email protected] ~]# head -1 /etc/issue
- Red Hat Enterprise Linux Server release 5.4 (Tikanga)
- [[email protected] ~]#
示例三:
- [email protected] root]# lsb_release
- LSB Version: 1.3
- [[email protected] 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
- [[email protected] root]#
时间: 2024-10-06 18:07:40