查看Linux系统版本信息的方法小结
程序员文章站
2022-05-09 18:05:17
这篇文章主要介绍了查看Linux系统版本信息的方法小结,主要针对RedHat系的Linux的命令,需要的朋友可以参考下... 15-10-22...
如何查看linux系统使用的版本信息呢? 下面这篇文章收集、整理了一些常见的查看linux系统版本的方法。由于手头只有oracle linux、centos linux、redhat linux三个版本linux,所以像debian、ubuntu之类的linux系统,下面方法在这些版本都没测试过。
1:more /etc/issue 命令查看
1.1 oracle linux
[root@db-server ~]# more /etc/issueoracle linux server release 5.7kernel \r on an \m
1.2 centos linux
[root@centos2 ~]# more /etc/issuecentos release 6.4 (final)kernel \r on an \m
1.3 redhat linux
[root@getlnx05 ~]# more /etc/issuered hat enterprise linux server release 5.7 (tikanga)kernel \r on an \m
2: lsb_release -a 命令查看
2.1 oracle linux
[root@db-server ~]# lsb_release -a
lsb version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
distributor id: enterpriseenterpriseserver
description: enterprise linux enterprise linux server release 5.7 (carthage)
release: 5.7
codename: carthage
2.2 centos linux
[root@centos2 ~]# 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.4 (final)
release: 6.4
codename: final
2.3 redhat linux
[root@getlnx05 ~]# lsb_release -a
lsb version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
distributor id: redhatenterpriseserver
description: red hat enterprise linux server release 5.7 (tikanga)
release: 5.7
codename: tikanga
3:cat /etc/redhat-release 命令查看
这个命令应该只有部分linux可以查看,不是所有版本linux都可以使用该命令
3.1 oracle linux
[root@db-server ~]# cat /etc/redhat-release
red hat enterprise linux server release 5.7 (tikanga)
[root@db-server etc]# cat /etc/*release
enterprise linux enterprise linux server release 5.7 (carthage)
oracle linux server release 5.7
red hat enterprise linux server release 5.7 (tikanga)
[root@db-server etc]# ls /etc/*lease
/etc/enterprise-release /etc/oracle-release /etc/redhat-release
[root@db-server etc]#
3.2 centos linux
[root@centos2 ~]# cat /etc/redhat-release
centos release 6.4 (final)
[root@centos2 ~]# cat /etc/*release
centos release 6.4 (final)
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
centos release 6.4 (final)
centos release 6.4 (final)
[root@centos2 ~]# ls /etc/*release
/etc/centos-release /etc/lsb-release /etc/redhat-release /etc/system-release
[root@centos2 ~]#
3.3 redhat linux
[root@getlnx05 ~]# cat /etc/redhat-release
red hat enterprise linux server release 5.7 (tikanga)
[root@getlnx05 ~]# cat /etc/*release
red hat enterprise linux server release 5.7 (tikanga)
[root@getlnx05 ~]# ls /etc/*release
/etc/redhat-release
[root@getlnx05 ~]#
4 rpm -q redhat-release命令查看,只适用于redhat linux
[root@getlnx05 ~]# rpm -q redhat-release
redhat-release-5server-5.7.0.3
1:more /etc/issue 命令查看
1.1 oracle linux
复制代码
代码如下:[root@db-server ~]# more /etc/issueoracle linux server release 5.7kernel \r on an \m
1.2 centos linux
复制代码
代码如下:[root@centos2 ~]# more /etc/issuecentos release 6.4 (final)kernel \r on an \m
1.3 redhat linux
复制代码
代码如下:[root@getlnx05 ~]# more /etc/issuered hat enterprise linux server release 5.7 (tikanga)kernel \r on an \m
2: lsb_release -a 命令查看
2.1 oracle linux
复制代码
代码如下:[root@db-server ~]# lsb_release -a
lsb version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
distributor id: enterpriseenterpriseserver
description: enterprise linux enterprise linux server release 5.7 (carthage)
release: 5.7
codename: carthage
2.2 centos linux
复制代码
代码如下:[root@centos2 ~]# 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.4 (final)
release: 6.4
codename: final
2.3 redhat linux
复制代码
代码如下:[root@getlnx05 ~]# lsb_release -a
lsb version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
distributor id: redhatenterpriseserver
description: red hat enterprise linux server release 5.7 (tikanga)
release: 5.7
codename: tikanga
3:cat /etc/redhat-release 命令查看
这个命令应该只有部分linux可以查看,不是所有版本linux都可以使用该命令
3.1 oracle linux
复制代码
代码如下:[root@db-server ~]# cat /etc/redhat-release
red hat enterprise linux server release 5.7 (tikanga)
[root@db-server etc]# cat /etc/*release
enterprise linux enterprise linux server release 5.7 (carthage)
oracle linux server release 5.7
red hat enterprise linux server release 5.7 (tikanga)
[root@db-server etc]# ls /etc/*lease
/etc/enterprise-release /etc/oracle-release /etc/redhat-release
[root@db-server etc]#
3.2 centos linux
复制代码
代码如下:[root@centos2 ~]# cat /etc/redhat-release
centos release 6.4 (final)
[root@centos2 ~]# cat /etc/*release
centos release 6.4 (final)
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
centos release 6.4 (final)
centos release 6.4 (final)
[root@centos2 ~]# ls /etc/*release
/etc/centos-release /etc/lsb-release /etc/redhat-release /etc/system-release
[root@centos2 ~]#
3.3 redhat linux
复制代码
代码如下:[root@getlnx05 ~]# cat /etc/redhat-release
red hat enterprise linux server release 5.7 (tikanga)
[root@getlnx05 ~]# cat /etc/*release
red hat enterprise linux server release 5.7 (tikanga)
[root@getlnx05 ~]# ls /etc/*release
/etc/redhat-release
[root@getlnx05 ~]#
4 rpm -q redhat-release命令查看,只适用于redhat linux
复制代码
代码如下:[root@getlnx05 ~]# rpm -q redhat-release
redhat-release-5server-5.7.0.3