转载来源:https://linuxconfig.org/check-what-debian-version-you-are-running-on-your-linux-system
How to Check out Debian Version ?
如何检查正在运行的Debian版本的最简单方法是简单地读取/etc/issue
文件内容。例:
root@debian:~# cat /etc/issue
Debian GNU/Linux 9 \n \l
但是上述命令可能不会显示当前的Debian更新点版本。因此,您可以使用以下linux命令获得更准确的信息:
root@debian:~# cat /etc/debian_version
9.0
接下来,您可以检查/etc/os-release
发布文件:
# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
另一种方法是使用lsb_release
命令。默认情况下可能缺少此命令,因此您可能需要先安装它:
#apt-get install lsb-release
安装上面的软件包后,运行以下linux命令,查看你在debian盒子上运行的debian版本:
$ lsb_release -da
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.0 (stretch)
Release: 9.0
Codename: stretch
PS:这个工具没有安装上,可能是因为笔者用的是 buster 版本
对于systemd
debian版本,您还可以使用hostnamectl
:
# hostnamectl
Static hostname: debian
Icon name: computer-vm
Chassis: vm
Machine ID: 6866ec1d654b4a2ea52d591dc0146d82
Boot ID: 51bfbc1e197b4d378e95073da0df0288
Virtualization: xen
Operating System: Debian GNU/Linux 9 (stretch)
Kernel: Linux 4.9.0-1-amd64
Architecture: x86-64