linux目前有哪些版本,【已解决】Linux系统中如何判断当前Linux是什么类型和什么版本即是哪个发行版...

【背景】

拿到一个Linux的服务器。

想要搞清楚,是哪个发行版,比如CentOS,Ubuntu等等。

以便于后续使用yum还是apt-get去install软件,以及做不同的配置。

【折腾过程】

1.通过uname,看不到想要的,只看到Linux:[root@bogon /]# uname -a

Linux bogon 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

2.搜:

how check which linux distribution

参考:

去试试:[root@bogon ~]# cat /etc/*-release

CentOS release 6.6 (Final)

LSB_VERSION=base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch

CentOS release 6.6 (Final)

CentOS release 6.6 (Final)

很明显可以看出来,是CentOS。

3.再去试试:[root@bogon ~]# lsb_release -a

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch

Distributor ID: CentOS

Description: CentOS release 6.6 (Final)

Release: 6.6

Codename: Final

4.以及:

[root@bogon ~]# cat /proc/version

Linux version 2.6.32-504.el6.x86_64 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) ) #1 SMP Wed Oct 15 04:27:16 UTC 2014

【总结】

Linux中,通过:cat /etc/*-release

或:

lsb_release -a

或:cat /proc/version

即可看出是哪个Linux的发行版。

其中最推荐的是用:lsb_release –a

【后记 2015-09-09】

1.后来在一个Linux系统,其实自己已经知道不是CentOS就是Ubuntu,但是想要确认到底是哪个系统。

结果去参考上述的办法,竟然:

没有lsbcrifan@crifan:~$ lsb_release -a

-bash: lsb_release: command not found

crifan@crifan:~$ yum search lsb

Loaded plugins: fastestmirror

Loading mirror speeds from cached hostfile

* base: mirrors.linode.com

* epel: mirror.smartmedia.net.id

* extras: mirrors.linode.com

* updates: mirrors.linode.com

================================================================ N/S matched: lsb =================================================================

redhat-lsb-core.i686 : LSB Core module support

redhat-lsb-core.x86_64 : LSB Core module support

redhat-lsb-cxx.i686 : LSB CXX module support

redhat-lsb-cxx.x86_64 : LSB CXX module support

redhat-lsb-desktop.i686 : LSB Desktop module support

redhat-lsb-desktop.x86_64 : LSB Desktop module support

redhat-lsb-languages.i686 : LSB Languages module support

redhat-lsb-languages.x86_64 : LSB Languages module support

redhat-lsb-printing.i686 : LSB Printing module support

redhat-lsb-printing.x86_64 : LSB Printing module support

redhat-lsb-submod-multimedia.i686 : LSB Multimedia submodule support

redhat-lsb-submod-multimedia.x86_64 : LSB Multimedia submodule support

redhat-lsb-submod-security.i686 : LSB Security submodule support

redhat-lsb-submod-security.x86_64 : LSB Security submodule support

redhat-lsb-supplemental.x86_64 : LSB supplemental dependencies required by LSB certification tests

redhat-lsb-trialuse.i686 : LSB Trialuse module support

redhat-lsb-trialuse.x86_64 : LSB Trialuse module support

redhat-lsb.i686 : Implementation of Linux Standard Base specification

redhat-lsb.x86_64 : Implementation of Linux Standard Base specification

Name and summary matches only, use "search all" for everything.

2.然后 cat /proc/version也没用:crifan@crifan:~$ cat /proc/version

Linux version 4.1.5-x86_64-linode61 (maker@build) (gcc version 4.7.2 (Debian 4.7.2-5) ) #7 SMP Mon Aug 24 13:46:31 EDT 2015

3.最后还是去参考:

去试了试:crifan@crifan:~$ cat /etc/*-release

CentOS Linux release 7.1.1503 (Core)

NAME="CentOS Linux"

VERSION="7 (Core)"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="7"

PRETTY_NAME="CentOS Linux 7 (Core)"

ANSI_COLOR="0;31"

CPE_NAME="cpe:/o:centos:centos:7"

HOME_URL="https://www.centos.org/"

BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"

CENTOS_MANTISBT_PROJECT_VERSION="7"

REDHAT_SUPPORT_PRODUCT="centos"

REDHAT_SUPPORT_PRODUCT_VERSION="7"

CentOS Linux release 7.1.1503 (Core)

CentOS Linux release 7.1.1503 (Core)

crifan@crifan:~$

所以,新的结论是:

如果:

像此处的CentOS 7中没有lsb_release

并且cat /proc/version没有输出对应的系统的类型和版本

那么:

可以去用:

cat /etc/*-release

即可看到输出中的信息中有

CentOS Linux release 7.1.1503

可以看出是CentOS,版本是7.1.1503

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值