Get a list of Ubuntu codename and version with wget
Get a list of Ubuntu codename and version with wget

I’m working a script to automatically backport Debian packages to Ubuntu. I needed a way to get a list of currently supported/active Ubuntu releases by codename or version. Here is how I do it.

Get a list of Ubuntu codenames

wget -q http://cdimage.ubuntu.com/releases/ -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep '^[[:space:]][a-z]' | sed 's/\///g'

Get a list of Ubuntu versions

wget -q http://cdimage.ubuntu.com/releases/ -O - | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' | grep '^[[:space:]][1-9]' | sed 's/\///g'