QuickPost: What version of Ubuntu am I running?

ubuntu_logo

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.

lsb_release -a

root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.10
Release:        16.10
Codename:       yakkety
root@ubuntu:~#

lsb_release -r

root@ubuntu:~# lsb_release -r
Release:        16.10

lsb_release_command

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.

NAME
       lsb_release - print distribution-specific information

SYNOPSIS
       lsb_release [options]

DESCRIPTION
       The  lsb_release command provides certain LSB (Linux Standard Base) and
       distribution-specific information.

       If no options are given, the -v option is assumed.

OPTIONS
       The program follows the  usual  GNU  command  line  syntax,  with  long
       options  starting  with  two  dashes  (`--').  A summary of options are
       included below.

       -v, --version
              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.

       -i, --id
              Display the distributor's ID.

       -d, --description
              Display a description of the currently installed distribution.

       -r, --release
              Display  the  release  number   of   the   currently   installed
              distribution.

       -c, --codename
              Display the code name of the currently installed distribution.

       -a, --all
              Display all of the above information.

       -s, --short
              Use the short output format for any information displayed.  This
              format omits the leading header(s).

       -h, --help
              Show summary of options.

REFERENCES

lsb_release manpage

comments powered by Disqus