查看 Linux 內核版本命令#
cat /proc/version#
@debian:~$ cat /proc/version
Linux 版本 5.10.0-21-amd64 ([email protected]) (gcc-10 (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2) #1 SMP Debian 5.10.162-1 (2023-01-21)
uname -a#
@debian:~$ uname -a
Linux debian 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64 GNU/Linux
查看 Linux 系統版本的命令#
lsb_release -a,即可列出所有版本資訊:#
@debian:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
💡 這個命令適用於所有的 Linux 發行版,包括 RedHat、SUSE、Debian… 等發行版。
cat /etc/redhat-release,這種方法只適合 Redhat 系的 Linux:#
cat /etc/issue,此命令也適用於所有的 Linux 發行版。#
@debian:~$ cat /etc/issue
Debian GNU/Linux 11 \n \l
cat /etc/os-release,此命令也適用於所有的 Linux 發行版。#
@debian:~$ cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
hostnamectl,此命令也適用於所有的 Linux 發行版。#
@debian:~$ hostnamectl
Static hostname: debian
Icon name: computer-vm
Chassis: vm
Machine ID: 9cbba9b9f67d45aba815c5aa9c2273a6
Boot ID: b4973cc962cc456392d70c8634026815
Virtualization: vmware
Operating System: Debian GNU/Linux 11 (bullseye)
Kernel: Linux 5.10.0-21-amd64
Architecture: x86-64