I needed to find out what Linux distro I'm running by using bash. Found this page, which was very helpful.
However my system has two /etc/*-release files
/etc/lsb-release
/etc/os-release
It seems os-release
has a little more info, but it looks that both of these files essentially do the same thing. Does anyone know what is the difference between them? While we are at it, what does lsb
in lsb-release
stand for?
The /etc/lsb-release is a text file that contains information about Ubuntu, such as the distribution id, distribution name, release number, and codename. This file is used by various tools to determine which Linux is being used. For example, the lsb_release command can be used to display the contents of this file.
os-release contains data that is defined by the operating system vendor and should generally not be changed by the administrator. As this file only encodes names and identifiers it should not be localized.
The /etc/os-release file contains operating system identification data, including information about the distribution. This file is part of the systemd package and should be present on all system running systemd.
The /etc/lsb-release
file is a file that some, but not all, Linux distributions put there for older programs to use. The "lsb" refers to the Linux Standard Base, a project working to define a common set of standards for any Linux distribution to follow, including things like filesystem layout. However, that file, /etc/lsb-release
, isn't part of the standard. It's an extra thing that some distributions use, but not all.
The /etc/os-release
file is the standard, however. Any distribution based on systemd, including Red Hat Enterprise Linux, CentOS, Fedora, Gentoo, Debian, Mint, Ubuntu, and many others, is required to have that file. Distributions that don't use systemd may also have the file.
If you need a reliable way of detecting what distribution you're running on, your best bet will be to read the /etc/os-release file. If it's not there you can try running the program called lsb_release
. But just ignore the /etc/lsb-release
file.
You can read more about os-release here and here. And just for fun, take a look at all the different files that Linux distributions used to use!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With