hi,欢迎访问本站!
当前位置: 首页操作系统正文

查看centos系统版本的方法

墨初 操作系统 624阅读

虽然centos系统已逐步停止维护,但centos的系统的使用者还是很多,想知道自己使用的centos系统的版本是多少,可以通过下面73so博客提供的命令来查看。

Centos查看系统版本的命令

1、使用cat命令查看系统版本

/etc/redhat-release 文件中包含了centos的版本信息。

命令:

[root@VM-16-2-centos ~]# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)

2、使用lsb_release命令

如果系统中安装了lsb_release工具,可以使用lsb_release命令查看系统的版本

lsb_release -a

3、查看 /etc/os-release文件 

在最新的centos版本,可以通过 /etc/os-release 文件查看系统的版本信息

[root@VM-16-2-centos ~]# 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"

4、hostnamectl命令

hostnamectl命令可以显示系统的主机名和版本信息。

[root@VM-16-2-centos ~]# hostnamectl
   Static hostname: VM-16-2-centos
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 1bc5fe07d422ab0d1e38d2cbb5c50
           Boot ID: 948b010fb64b2280c8d64180a16416
    Virtualization: kvm
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1160.71.1.el7.x86_64
      Architecture: x86-64

5、/etc/system-release-cpe文件

另一个包含centos系统版本信息的文件是/etc/system-release-cpe,可以使用cat命令查看

cat /etc/system-release-cpe

以上就是几种查看centos系统版本号的方法,可以根据自己的需求选择。

声明:无特别说明,转载请标明本文来源!
相关推荐