要查看Linux系统是否为CentOS,您可以使用以下几种方法:
/etc/redhat-release
文件打开终端,输入以下命令:
cat /etc/redhat-release
如果系统是CentOS,则会输出类似以下内容的信息:
CentOS Linux release 7.9.2009 (Core)
/etc/os-release
文件在CentOS 7或更高版本中,可以运行以下命令:
cat /etc/os-release
输出将包含类似以下的信息:
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"
lsb_release
命令如果系统上未安装 lsb_release
,可以通过包管理器安装(例如,对于CentOS/RHEL使用 yum
):
sudo yum install redhat-lsb-core
lsb_release -a
输出将显示类似以下的信息:
Distributor ID: CentOS
Description: CentOS Linux release 7.9.2009 (Core)
Release: 7.9.2009
Codename: Core
通过上述方法,您可以轻松地确认Linux系统是否为CentOS。
云+社区沙龙online第6期[开源之道]
2022OpenCloudOS社区开放日
Elastic 实战工作坊
Elastic 实战工作坊
腾讯技术创作特训营第二季
腾讯云数据库TDSQL训练营
云+社区技术沙龙[第14期]
Techo Day
DB TALK 技术分享会
云+社区技术沙龙[第10期]
领取专属 10元无门槛券
手把手带您无忧上云