Get Debian version number

I use several different machines and while most of them run a flavour of Debian I can never remember exactly which version I’m running on which system.

Most of the time it doesn’t really matter which version I’m using, but occasionally I do need to check the release and I can never remember how. Hopefully after writing up a couple of ways to check the version number I will be able to remember one of them!

The easiest way is to look at the contents of ‘/etc/debian_version’.

cat /etc/debian_version

If you are looking for a bit more detail then you can use ‘lsb_release’, but you may have to install it first.

apt-get install lsb-release
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
Need to get 26.5 kB of archives.
After this operation, 99.3 kB of additional disk space will be used.
Setting up lsb-release (4.1+Debian13+nmu1) ...

lsb_release -da
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 8.11 (jessie)
Release: 8.11
Codename: jessie

And this command also works on older releases.

lsb_release -da
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 5.0.10 (lenny)
Release:        5.0.10
Codename:       lenny

Alternativly on recent versions of Debian you can get quite a lot of useful information using ‘hostnamectl’ including the hostname, kernel version and the type of machine.

   Static hostname: hostname
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: 1ac3f567cb78ff608a9cb135c24fcb39
           Boot ID: 7afb50389bf609adedb523dc0934d132
  Operating System: Debian GNU/Linux 8 (jessie)
            Kernel: Linux 3.16.0-4-amd64
      Architecture: x86-64

This entry was posted in Linux. Bookmark the permalink.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.