最新消息:20210917 已从crifan.com换到crifan.org

【已解决】CentOS8中确认Linux是哪个系统发行版

Linux crifan 494浏览 0评论
折腾:
【未解决】配置华为云服务器实现域名转发从crifan.com转发到crifan.org
期间,此处已知Linux系统是CentOS8
但是想要确认一下。
想要确认是哪个发行版,是不是CentOS,结果:
[root@ecs-38292 ~]# cat /proc/*-release
cat: '/proc/*-release': No such file or directory
[root@ecs-38292 ~]# cat /proc//etc/*-release
cat: '/proc//etc/*-release': No such file or directory
找不到。
【已解决】Linux系统中如何判断当前Linux是什么类型和什么版本即是哪个发行版 – 在路上 (crifan.com)
cat /proc/version
[root@ecs-38292 ~]# cat /proc/version 
Linux version 4.18.0-240.10.1.el8_3.x86_64 (
mockbuild@kbuilder.bsys.centos.org
) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Mon Jan 18 17:05:51 UTC 2021
也没写CentOS
不过其实
mockbuild@kbuilder.bsys.centos.org
中有centos
[root@ecs-38292 ~]# ls /etc | grep release
centos-release
centos-release-upstream
lsb-release.d
os-release
redhat-release
system-release
system-release-cpe
有:centos-release 
[root@ecs-38292 ~]# cat /etc/centos-release
centos-release           centos-release-upstream  
[root@ecs-38292 ~]# cat /etc/centos-release-upstream 
Derived from Red Hat Enterprise Linux 8.2 (Source)
[root@ecs-38292 ~]# cat /etc/centos-release
CentOS Linux release 8.2.2004 (Core) 
[root@ecs-38292 ~]# cat /etc/lsb-release.d/core-4.1-
core-4.1-amd64   core-4.1-noarch  
[root@ecs-38292 ~]# cat /etc/lsb-release.d/core-4.1-amd64 
[root@ecs-38292 ~]# cat /etc/lsb-release.d/core-4.1-noarch 
以及:
[root@ecs-38292 ~]# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
以及:
[root@ecs-38292 ~]# cat /etc/re
redhat-lsb/     redhat-release  resolv.conf     
[root@ecs-38292 ~]# cat /etc/redhat-release 
CentOS Linux release 8.2.2004 (Core) 
[root@ecs-38292 ~]# cat /etc/redhat-lsb/
cat: /etc/redhat-lsb/: Is a directory
[root@ecs-38292 ~]# cat /etc/redhat-lsb/lsb_
lsb_killproc      lsb_log_message   lsb_pidofproc     lsb_start_daemon  
[root@ecs-38292 ~]# cat /etc/redhat-lsb/lsb_^C
和:
[root@ecs-38292 ~]# cat /etc/system-release
CentOS Linux release 8.2.2004 (Core) 
和:
[root@ecs-38292 ~]# cat /etc/system-release-cpe 
cpe:/o:centos:centos:8
另外,发现有lsb_release:
[root@ecs-38292 ~]# which lsb_release
/usr/bin/lsb_release
去试试:
[root@ecs-38292 ~]# lsb_release
LSB Version:    :core-4.1-amd64:core-4.1-noarch
不加参数,输出内容很少啊
去加上-a:
[root@ecs-38292 ~]# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.2.2004 (Core) 
Release:        8.2.2004
Codename:       Core
【总结】
此处,查看Linux是哪个发行版。
对于此处的CentOS 8:
(1)是有lsb_release的
# which lsb_release
/usr/bin/lsb_release
然后即可用:
lsb_release -a
此处输出:
# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 8.2.2004 (Core) 
Release:        8.2.2004
Codename:       Core
(2)/etc/下面有多个release
[root@ecs-38292 ~]# ls /etc | grep release
centos-release
centos-release-upstream
lsb-release.d
os-release
redhat-release
system-release
system-release-cpe
其中能输出CentOS的有:
# cat /etc/centos-release
CentOS Linux release 8.2.2004 (Core)
和:
# cat /etc/centos-release-upstream 
Derived from Red Hat Enterprise Linux 8.2 (Source)
和:
# cat /etc/os-release 
NAME="CentOS Linux"
VERSION="8 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="8"
PLATFORM_ID="platform:el8"
PRETTY_NAME="CentOS Linux 8 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:8"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"


CENTOS_MANTISBT_PROJECT="CentOS-8"
CENTOS_MANTISBT_PROJECT_VERSION="8"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="8"
和:
# cat /etc/redhat-release 
CentOS Linux release 8.2.2004 (Core) 
和:
# cat /etc/system-release
CentOS Linux release 8.2.2004 (Core) 
和:
# cat /etc/system-release-cpe 
cpe:/o:centos:centos:8
(3)cat /proc/version
# cat /proc/version
Linux version 4.18.0-240.10.1.el8_3.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 8.3.1 20191121 (Red Hat 8.3.1-5) (GCC)) #1 SMP Mon Jan 18 17:05:51 UTC 2021
-》其中只有邮件后缀中有 centos

转载请注明:在路上 » 【已解决】CentOS8中确认Linux是哪个系统发行版

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
89 queries in 0.105 seconds, using 21.45MB memory