Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

/etc/lsb-release vs /etc/os-release

Tags:

linux

bash

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?

like image 471
flashburn Avatar asked Dec 15 '17 19:12

flashburn


People also ask

What is ETC lsb-release?

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.

What is os-release?

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.

What is ETC version?

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.


1 Answers

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!

like image 155
Todd Walton Avatar answered Nov 02 '22 21:11

Todd Walton