Last updated on June 10, 2020 by Dan Nanni
There are many cases where you need to run some batch processing jobs which can vary across different Ubuntu releases (e.g., Quantal Quetzal, Raring Ringtail, Saucy Salamander, Trusty Tahr, Utopic Unicorn). For example, you may want to download a source package which is available as multiple Ubuntu release versions, or you may want to access Ubuntu repositories for different releases. Often times, available source packages or repositories may be named after the "codename" or "nickname" (e.g., quantal, raring, saucy, trusty, utopic) of Ubuntu releases.
If you need to find the version/codename of your Ubuntu system from the command line, you can use lsb_release
command which displays distribution-specific information.
The following shell script snippet demonstrate how to store the version and codename of Ubuntu in two different variables.
#!/bin/sh version=`lsb_release --release | cut -f2` codename=`lsb_release --codename | cut -f2` echo $version echo $codename
lsb_release
command also works on other Linux distros, including Debian, CentOS, Fedora and OpenSUSE.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean