Detect what debian-based distribution you are working in

Detect what debian-based distribution you are working in

In this tutorial, I would like to talk to you about your Linux distribution and how you can find that in which distribution you were working on.

Just execute lsb_release -a.

On Debian:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux testing (stretch)
Release: testing
Codename: stretch

On Ubuntu:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty

In case when you don’t have lsb_release installed you may want to try some guessing, for example, there is a file
/etc/issue that often contains distribution name. For example, on ubuntu:

$ cat /etc/issue
Ubuntu 12.04.5 LTS \n \l

Don’t use file /etc/debian_version because its contents do not match the distribution name!

Note that this will also work on non-Debian-family distributions like Fedora, RHEL, or openSUSE — but that lsb_release may not be installed.

check linux distro terminallinux distributionslinux distroslinux os versionubuntu linux os
Comments (0)
Add Comment