输出

输出

我有时会忘记 Debian 的版本号和代号。
当然,lsb-release -a或者cat /etc/os-release打印有关我登录的当前系统的格式良好的信息,但是:

是否有列出所有以前版本的联机帮助页或帮助文档?

(理想情况下,它是“本机”的东西,所以不需要安装工具。而且相对容易记住,所以不需要curl网页)

我没有找到man页面,并认为我可能会在其中找到一些东西/usr/share/doc,但不幸的是没有。

我发现的是一个 python 文件,它给出了:

grep 'Description: Debian' /usr/share/python-apt/templates/Debian.info
Description: Debian 11 'bullseye'
Description: Debian 10 'buster'
Description: Debian 9 'stretch'
Description: Debian 8 'jessie'
Description: Debian 7 'Wheezy' 
Description: Debian 6.0 'Squeeze' 
Description: Debian 5.0 'Lenny' 
Description: Debian 4.0 'Etch'
Description: Debian 3.1 'Sarge'
Description: Debian current stable release
Description: Debian testing
Description: Debian 'Sid' (unstable)

作为一种解决方法,这很酷,但取决于python-apt要安装的软件包,而这不是我想要的。

编辑:

感谢@Gilles 找到/usr/share/distro-info/debian.csv(和 ubuntu.csv)
这个文件几乎是完美的,它甚至包含创建、发布和“LTS 结束”的日期,例如:

...
9,Stretch,stretch,2015-04-25,2017-06-17,2020-07-06
...

答案1

正如 Gilles Quenot 所说,没有包含此信息的手册页;然而,该distro-info软件包提供了一个命令,可以向您显示这一点:

$ distro-info -af
Debian 1.1 "Buzz"
Debian 1.2 "Rex"
Debian 1.3 "Bo"
Debian 2.0 "Hamm"
Debian 2.1 "Slink"
Debian 2.2 "Potato"
Debian 3.0 "Woody"
Debian 3.1 "Sarge"
Debian 4.0 "Etch"
Debian 5.0 "Lenny"
Debian 6.0 "Squeeze"
Debian 7 "Wheezy"
Debian 8 "Jessie"
Debian 9 "Stretch"
Debian 10 "Buster"
Debian 11 "Bullseye"
Debian 12 "Bookworm"
Debian 13 "Trixie"
Debian  "Sid"
Debian  "Experimental"

更明确地说,debian-distro-info列出了 Debian 版本,ubuntu-distro-info列出了 Ubuntu 版本。distro-info默认为适合您正在使用的发行版的任何内容。

答案2

没有man page

find /usr/share/man -exec zgrep -li 'Wheezy|Potato' {} + 2>/dev/null

没有匹配

一种方法,仅使用一种awk

awk -F, '{print $1, $2}' /usr/share/distro-info/debian.csv
version codename
1.1 Buzz
1.2 Rex
1.3 Bo
2.0 Hamm
2.1 Slink
2.2 Potato
3.0 Woody
3.1 Sarge
4.0 Etch
5.0 Lenny
6.0 Squeeze
7 Wheezy
8 Jessie
9 Stretch
10 Buster
11 Bullseye
12 Bookworm
13 Trixie
 Sid
 Experimental

为了Ubuntu

awk -F, '{print $1, $2}' /usr/share/distro-info/ubuntu.csv 
version codename
4.10 Warty Warthog
5.04 Hoary Hedgehog
5.10 Breezy Badger
6.06 LTS Dapper Drake
6.10 Edgy Eft
7.04 Feisty Fawn
7.10 Gutsy Gibbon
8.04 LTS Hardy Heron
8.10 Intrepid Ibex
9.04 Jaunty Jackalope
9.10 Karmic Koala
10.04 LTS Lucid Lynx
10.10 Maverick Meerkat
11.04 Natty Narwhal
11.10 Oneiric Ocelot
12.04 LTS Precise Pangolin
12.10 Quantal Quetzal
13.04 Raring Ringtail
13.10 Saucy Salamander
14.04 LTS Trusty Tahr
14.10 Utopic Unicorn
15.04 Vivid Vervet
15.10 Wily Werewolf
16.04 LTS Xenial Xerus
16.10 Yakkety Yak
17.04 Zesty Zapus
17.10 Artful Aardvark
18.04 LTS Bionic Beaver
18.10 Cosmic Cuttlefish
19.04 Disco Dingo
19.10 Eoan Ermine
20.04 LTS Focal Fossa
20.10 Groovy Gorilla
21.04 Hirsute Hippo
21.10 Impish Indri
22.04 LTS Jammy Jellyfish
22.10 Kinetic Kudu
23.04 Lunar Lobster

其他方式:

xidel -se '//div[@id="toc"]/ul//li//li/a' \
    https://en.wikipedia.org/wiki/Debian_version_history | 
    cut -d ' ' -f2-

或者

curl -sL https://en.wikipedia.org/wiki/Debian_version_history |
     xmlstarlet format -H - 2>/dev/null |
     xmlstarlet sel -t -v '//div[@id="toc"]/ul//li//li/a' - |
     cut -d ' ' -f2-

输出

Debian 1.1 (Buzz)
Debian 1.2 (Rex)
Debian 1.3 (Bo)
Debian 2.0 (Hamm)
Debian 2.1 (Slink)
Debian 2.2 (Potato)
Debian 3.0 (Woody)
Debian 3.1 (Sarge)
Debian 4.0 (Etch)
Debian 5.0 (Lenny)
Debian 6.0 (Squeeze)
Debian 7 (Wheezy)
Debian 8 (Jessie)
Debian 9 (Stretch)
Debian 10 (Buster)
Debian 11 (Bullseye)
Debian 12 (Bookworm)

答案3

除了其他出色的答案之外,我现在还通过 gpg 钥匙圈找到了另一种方法(奇怪,ack没有找到这个,但grep确实找到了)

这应该也适用于旧机器,因为 gpg 密钥环应该随处可用:

gpg /usr/share/keyrings/debian-archive-keyring.gpg |grep uid 
gpg /usr/share/keyrings/debian-archive-removed-keys.gpg |grep uid  # on the debian7 machine I tested, I had to leave out the "grep uid"

(对于 ubuntu 这似乎不起作用,因为钥匙圈的结构不同)

答案4

打开网络浏览器(我假设您已经安装了)并访问https://en.wikipedia.org/wiki/Debian_version_history

相关内容