2

I very frequently forget release name corresponding to my Ubuntu version. Is there an easy method (preferably command-line one) to go from say

11.10 ->  Distro Name

I know we have

lsb_release -a

Say someone has Skeltor, and I want to know if Zenogi is newer? How much time has passed between the two releases? How many releases they are apart ?

Evan Carroll
  • 7,703

2 Answers2

7

If you need to know only your OS version's name, use /etc/os-release file:

$ cat /etc/os-release                                                                                             
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

There exists /usr/share/distro-info/ubuntu.csv file, which you can parse via text processing utilities , such as AWK , grep, python, perl , or any other.

Actually, there is a command ubuntu-distro-info. It is not installed by default but you can obtain it via sudo apt-get install distro-info. The command itself is a shell script, and relies on the mentioned ubuntu.csv file. So if you don't want to think too hard and write scripts yourself , use that:

$ ubuntu-distro-info --all -f
Ubuntu 4.10 "Warty Warthog"
Ubuntu 5.04 "Hoary Hedgehog"
Ubuntu 5.10 "Breezy Badger"
Ubuntu 6.06 LTS "Dapper Drake"
Ubuntu 6.10 "Edgy Eft"
Ubuntu 7.04 "Feisty Fawn"
Ubuntu 7.10 "Gutsy Gibbon"
Ubuntu 8.04 LTS "Hardy Heron"
Ubuntu 8.10 "Intrepid Ibex"
Ubuntu 9.04 "Jaunty Jackalope"
Ubuntu 9.10 "Karmic Koala"
Ubuntu 10.04 LTS "Lucid Lynx"
Ubuntu 10.10 "Maverick Meerkat"
Ubuntu 11.04 "Natty Narwhal"
Ubuntu 11.10 "Oneiric Ocelot"
Ubuntu 12.04 LTS "Precise Pangolin"
Ubuntu 12.10 "Quantal Quetzal"
Ubuntu 13.04 "Raring Ringtail"
Ubuntu 13.10 "Saucy Salamander"
Ubuntu 14.04 LTS "Trusty Tahr"
Ubuntu 14.10 "Utopic Unicorn"
Ubuntu 15.04 "Vivid Vervet"
Ubuntu 15.10 "Wily Werewolf"
Ubuntu 16.04 LTS "Xenial Xerus"
Ubuntu 16.10 "Yakkety Yak"
Ubuntu 17.04 "Zesty Zapus"

It has many other command-line flags, like -y for checking how many days are left until next milestone, be it reaching release stage or End-of-Life status. For example, this: distro-info --all -f -y"eol" will tell you negative values for those that have reached End of Life status and positive for those that haven't.

4

I don't know if there's a command, but the information is in http://changelogs.ubuntu.com/meta-release:

Dist: warty
Name: Warty Warthog
Version: 04.10
Date: Wed, 20 Oct 2004 07:28:17 UTC
Supported: 0
Description: This is the warty warthog release
Release-File: http://old-releases.ubuntu.com/ubuntu/dists/warty/Release

Dist: hoary
Name: Hoary  Hedgehog
Version: 05.04
Date: Fri, 08 Apr 2005 08:18:19 UTC
Supported: 0
Description: This is the Hoary Hedgehog release
Release-File: http://old-releases.ubuntu.com/ubuntu/dists/hoary/Release

Dist: breezy
Name: Breezy Badger
Version: 05.10
...

You can parse that to obtain the information needed (the releases are in order, the time of release is given). The Update Manager code parses this file, so you can adapt that to your needs.

muru
  • 207,228