USING lsb_release TO DISPLAY THE RUNNING UBUNTU VERSION
This is a QuickPost™ (not really trademarked), and I’ll get to the point. To find out what version of Ubuntu a system is running use the command lsb_release. This isn’t something you’ll need everyday, but when you do it’s good to know.
There several options when running lsb_release, but the two you’re most likely to find useful are lsb_release -a - show everything, and lsb_release -r - show only the release.
root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.10
root@ubuntu:~# lsb_release -r
There’s not much else to say. You could look at some system files and extrapolate the version from there, but why do that when one command can give you everything you need?
The manpage is short so I’ve posed the majority of it below.
lsb_release - print distribution-specific information
The lsb_release command provides certain LSB (Linux Standard Base) and
If no options are given, the -v option is assumed.
The program follows the usual GNU command line syntax, with long
options starting with two dashes (`--'). A summary of options are
Show the version of the LSB against which your current
installation is compliant. The version is expressed as a colon
separated list of LSB module descriptions.
Display the distributor's ID.
Display a description of the currently installed distribution.
Display the release number of the currently installed
Display the code name of the currently installed distribution.
Display all of the above information.
Use the short output format for any information displayed. This
format omits the leading header(s).
Show summary of options.