centos 查看版本

在 CentOS 中,查看系统版本有多种方法。以下是几种常用的方法:

方法 1:使用 cat 命令查看 /etc/centos-release 文件

cat /etc/centos-release

这个文件包含了 CentOS 的版本信息。例如,输出可能是:

CentOS Linux release 7.9.2009 (Core)

方法 2:使用 lsb_release 命令

lsb_release 命令可以显示 Linux 发行版的详细信息,包括版本号。首先,确保你已经安装了 redhat-lsb-core 包:

sudo yum install redhat-lsb-core

然后,使用以下命令查看版本信息:

lsb_release -a

输出示例:

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core

方法 3:使用 rpm 命令查看 centos-release 包

rpm -q centos-release

输出示例:

centos-release-7-9.2009.0.el7.centos.x86_64

方法 4:使用 hostnamectl 命令

hostnamectl 命令可以显示系统的详细信息,包括操作系统版本:

hostnamectl

输出示例:

   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 1234567890abcdef1234567890abcdef
           Boot ID: 1234567890abcdef1234567890abcdef
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.el7.x86_64
      Architecture: x86-64

方法 5:使用 uname 命令

uname 命令可以显示内核版本,结合 -r 选项可以显示详细的内核版本信息:

uname -r

输出示例:

3.10.0-1160.el7.x86_64

通过这些方法,你可以轻松查看 CentOS 系统的版本信息。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值