baicai

白菜

一个勤奋的代码搬运工!

查看 Debian 系統版本的方式

查看 Dibian 系統發行版本號的方式

1. 使用 lsb_release 命令#

lsb_release 命令可用於查看 Linux 發行版操作系統的具體版本。它可能尚未安裝在你的操作系統中,因此你需要先安裝它。運行以下命令來安裝 lsb_release:

    apt-get install lsb-release

安裝完成之後,只需要輸入下面的命令就可以查看到你當前系統的版本信息:

    lsb_release -a

你將看到類似下面的結果:

    No LSB modules are available.
    Distributor ID:	Debian
    Description:	Debian GNU/Linux 11 (bullseye)
    Release:	11
    Codename:	bullseye

以上運行結果說明當前使用的操作系統版本是 Debian 11.

2. 查看 /etc/issue 文件#

第二種查看當前 Debian 版本的方法是查看位於 /etc 目錄中的 issue 文件。你可以使用 cat 命令查看文件的內容,輸入下面的命令:

    cat /etc/issue

你將看到類似下面的結果:

    Debian GNU/Linux 11 \n \l

3. 查看 /etc/os-release 文件#

/etc/os-release 是一個包含操作系統標識數據的文件,它只能在運行 systemd 的最新 Debian 發行版上找到。同樣可以使用 cat 命令查看該文件的內容,輸入下面的命令:

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/"

如果想知道更具體的小版本號,可以查看 /etc/debian_version 文件,輸入下面的命令:

    cat /etc/debian_version

你將看到類似下面的結果:

    11.4

4. 使用 uname 命令#

uname 命令可以顯示電腦以及操作系統的相關信息,輸入下面的命令:

    uname -a

你將看到類似下面的結果:

    Linux baicai-l01 5.10.0-16-amd64 #1 SMP Debian 5.10.127-1 (2022-06-30) x86_64 GNU/Linux

5. 使用 hostnamectl 命令#

hostnamectl 命令用於配置或修改系統的主機名,不過也使用此命令來獲取 Debian 系統的版本,只需要直接輸入 hostnamectl 即可:

    hostnamectl

你將看到類似下面的結果:

   Static hostname: baicai-l01
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: xxx
           Boot ID: xxx
  Operating System: Debian GNU/Linux 11 (bullseye)
            Kernel: Linux 5.10.0-16-amd64
      Architecture: x86-64
載入中......
此文章數據所有權由區塊鏈加密技術和智能合約保障僅歸創作者所有。