What is the official way to determine that the remote Linux is Fedora?

I tried cat /etc/os-release and hostnamectl. Both contain Fedora in some way. Which is the official, preferred way?

How about lsb_release ?

$ lsb_release -is
Fedora
$ lsb_release -rs
37
$ lsb_release -a
LSB Version:	:core-4.1-amd64:core-4.1-noarch
Distributor ID:	Fedora
Description:	Fedora release 37 (Thirty Seven)
Release:	37
Codename:	ThirtySeven
$

I don’t think there is an “official way”. There are whole bunch of different ways though.

I think that /etc/os-release is probably the most universal way.

3 Likes

I think hostnamectl takes the value of PRETTY NAME from /etc/os-release anyway. I’d suggest using /etc/os-release, since it’s shipped by the different release packages.

1 Like

I usually go with cat /etc/redhat-release or cat /etc/os-release

1 Like

lsb-release and hostnamectl are not available on all UNIXes, not even on all Linuxes. os-release sounds like the safest bet.