如何查看自己的linux系统版本

在 Linux 系统中,可以通过以下几种方法查看自己的系统信息:

使用lsb_release命令1:

如果系统中安装了lsb_release工具,可以在终端中输入lsb_release -a命令。该命令会显示系统的发行商、版本号、代号等详细信息。例如,在 Ubuntu 系统中执行该命令可能会显示类似如下信息:

Distributor ID: Ubuntu

Description: Ubuntu 22.04.3 LTS

Release: 22.04

Codename: jammy

查看/etc/os-release文件4:

在终端中输入cat /etc/os-release命令。这个文件记录了系统的相关信息,包括发行版名称、版本号、ID 等。例如,对于 CentOS 系统,该文件中的部分信息可能如下:

NAME="CentOS Linux"

VERSION="8.5.2111"

ID="centos"

ID_LIKE="rhel fedora"

VERSION_ID="8.5"

查看/etc/issue文件137:

输入cat /etc/issue命令。该文件通常也包含系统的版本及发行信息,但显示的格式可能因发行版而异。例如,在一些 Ubuntu 系统中,可能显示的信息类似Ubuntu 20.04 LTS \n \l6。使用uname命令123:

输入uname -a命令可以查看系统的内核版本、主机名、操作系统的发行版号等信息。不过,这里显示的发行版信息可能不是特别详细1。例如: Linux hostname 5.15.0-76-generic #83-Ubuntu SMP Thu Jun 22 09:55:33 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

使用hostnamectl命令(如果系统支持)4:

对于使用systemd的系统,可以输入hostnamectl命令。该命令主要用于处理主机名相关的操作,但也会提供系统的其他信息,包括操作系统的名称和版本等4。例如,在 CentOS 系统中执行该命令可能会显示如下信息:

Static hostname: centos-host

Transient hostname: centos-host

Icon name: computer-vm

Chassis: vm

Machine ID: xxxxxxxxxxxxxxxxxxxxxxx

Boot ID: xxxxxxxxxxxxxxxxxxxxxxx

Virtualization: kvm

Operating System: CentOS Linux 8 (Core)

CPE OS Name: cpe:/o:centos:centos:8

Kernel: Linux 4.18.0-305.19.1.el8_4.x86_64

Architecture: x86-64

```{insert\_element\_8\_}