当前位置:首页 > linux > 正文

linux怎么查看系统的版本信息

  • linux
  • 2024-05-07 08:26:32
  • 7174

有几种方法可以查看 Linux 系统的版本信息:
1. uname 命令
uname -a
此命令将打印系统的所有版本信息,包括:
内核版本
发行版名称和版本
系统主机名
CPU 架构
2. /etc/os-release 文件
此文件包含有关系统发行版的详细信息,包括:
ID:发行版的名称
VERSION_ID:发行版的版本号
PRETTY_NAME:发行版的完整名称
HOME_URL:发行版的官方网站地址
cat /etc/os-release
3. lsb_release 命令
此命令仅适用于 Ubuntu 等基于 Debian 的发行版。 它提供的版本信息比 uname 或 /etc/os-release 文件更详细:
lsb_release -a
4. /proc/version 文件
此文件包含有关内核版本和编译信息:
cat /proc/version
5. hostnamectl 命令
此命令提供有关系统主机名和版本信息的摘要:
hostnamectl
6. neofetch 命令(可选)
此命令安装后会显示一个信息丰富的系统信息摘要,包括版本信息:
sudo apt install neofetch
neofetch
示例输出
以下是 Ubuntu 20.04 系统的版本信息示例输出:
uname -a
Linux hostname 5.4.0-82-generic #98-Ubuntu SMP Thu Aug 5 06:02:27 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
cat /etc/os-release
PRETTY_NAME="Ubuntu 20.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="20.04"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal
hostnamectl
Static hostname: hostname
Icon name: computer-vm
Operating System: Ubuntu 20.04.2 LTS
Kernel: Linux 5.4.0-82-generic
Architecture: x86-64