debian has “codenames” for it’s releases… i always get confused which codename is what release number. with those commands you can easily identify both.

hostnamectl seems to be the cross-distribution solution for that.

user@suse12:~> hostnamectl
   Static hostname: suse12.domain
Transient hostname: suse12
         Icon name: computer-vm
           Chassis: vm
        Machine ID: fe6bf561a4d4f20df6176faf58fdd5b5
           Boot ID: 9153a309e2a943b0b6a2fb315302ad19
    Virtualization: microsoft
  Operating System: SUSE Linux Enterprise Server 12 SP2
       CPE OS Name: cpe:/o:suse:sles:12:sp2
            Kernel: Linux 4.4.21-69-default
      Architecture: x86-64


[root@CentOS7 ~]# hostnamectl
   Static hostname: CentOS7
         Icon name: computer-vm
           Chassis: vm
        Machine ID: ad6f3410bf2346ec97a6fdc05dc4a607
           Boot ID: 550f448f0b4b49d9abab7ec65dfb42cb
    Virtualization: microsoft
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-514.el7.x86_64
      Architecture: x86-64

root@Debian8:~# hostnamectl
   Static hostname: Debian8
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a13b0cebc0aa403c8c7a416ef378eedb
           Boot ID: 93585650c4ef4c99929ca5b3d45d93eb
    Virtualization: microsoft
  Operating System: Debian GNU/Linux 8 (jessie)
            Kernel: Linux 3.16.0-4-686-pae
      Architecture: x86

root@Debian8:~# lsb_release -a; # alternatively debian only

No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.8 (jessie)
Release:        8.8
Codename:       jessie

root@Debian8:~# cat /etc/debian_version; # outputs just the release number
8.8

root@Debian8:~# uname -a; # info about used kernel version and 32Bit or 64Bit
Linux Debian8 3.16.0-4-686-pae #1 SMP Debian 3.16.43-2 (2017-04-30) i686 GNU/Linux

manpages:

hostnamectl.man.txt

liked this article?

  • only together we can create a truly free world
  • plz support dwaves to keep it up & running!
  • (yes the info on the internet is (mostly) free but beer is still not free (still have to work on that))
  • really really hate advertisement
  • contribute: whenever a solution was found, blog about it for others to find!
  • talk about, recommend & link to this blog and articles
  • thanks to all who contribute!
admin