插件窝 干货文章 如何查看linux是什么版本

如何查看linux是什么版本

release 系统 版本 bash 466    来源:    2025-04-12

在Linux系统中,可以通过以下多种方法查看系统版本信息:


1. 查看内核版本

uname -r

输出示例:
5.4.0-135-generic
(表示内核版本为5.4)


2. 查看发行版详细信息

适用于大多数系统(如Ubuntu/Debian/CentOS/RHEL等)

cat /etc/os-release

lsb_release -a

输出示例(Ubuntu):

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=22.04
DISTRIB_CODENAME=jammy

CentOS/RHEL/Fedora

cat /etc/redhat-release

hostnamectl

3. 检查系统架构

uname -m

输出示例:
- x86_64(64位系统)
- i386/i686(32位系统)


4. 其他辅助命令

  • 查看所有系统信息(内核+发行版)
    bash uname -a
  • 检查系统启动时间(间接判断版本新旧)
    bash uptime

常见发行版文件路径

发行版 版本文件路径
Ubuntu/Debian /etc/lsb-release
CentOS/RHEL /etc/redhat-release
Arch /etc/arch-release
Alpine /etc/alpine-release

总结

  • 内核版本uname -r
  • 发行版信息cat /etc/os-releaselsb_release -a
  • 快速确认hostnamectl(支持systemd的系统)

根据你的需求选择合适的方法即可!