要查看 Ubuntu 系统的版本信息,可以使用以下命令:
(1)使用 lsb_release 命令:
hxstrive@g450:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.4 LTS
Release: 22.04
Codename: jammy这个命令将显示完全的系统信息,包括版本号。
(2)使用 cat 命令查看 /etc/issue 文件:
hxstrive@g450:~$ cat /etc/issue
Ubuntu 22.04.4 LTS \n \l这个命令将显示 Ubuntu 系统的版本号。
(3)使用 cat 命令查看 /etc/os-release 文件:
hxstrive@g450:~$ cat /etc/os-release
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy这个命令将显示 Ubuntu 系统的版本号和其他相关信息。
(4)使用 cat 命令查看 /proc/version 文件:
hxstrive@g450:~$ cat /proc/version
Linux version 5.15.0-43-generic (buildd@lcy02-amd64-076) (gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, GNU ld (GNU Binutils for Ubuntu) 2.38) #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022这个命令将显示 Linux 内核的版本信息。
(5)使用 uname 命令:
hxstrive@g450:~$ uname -a
Linux g450 5.15.0-43-generic #46-Ubuntu SMP Tue Jul 12 10:30:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux这个命令将显示操作系统的详细信息,包括内核版本和主机名等。
(6)使用 hostnamectl 命令(需要systemd支持):
hxstrive@g450:~$ hostnamectl
Static hostname: g450
Icon name: computer-laptop
Chassis: laptop
Machine ID: 06fc4f5d38a541ad972aa7bbaf3e13de
Boot ID: faaf863f0b2f4d1481c1201b79a080f5
Operating System: Ubuntu 22.04.4 LTS
Kernel: Linux 5.15.0-43-generic
Architecture: x86-64
Hardware Vendor: Lenovo
Hardware Model: Lenovo G450这个命令将显示系统的详细信息,包括主机名、操作系统版本等。