LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How do I know which distribution I have? (https://www.linuxquestions.org/questions/linux-newbie-8/how-do-i-know-which-distribution-i-have-4175666262/)

RandomTroll 12-19-2019 09:20 PM

How do I know which distribution I have?
 
I'm trying to help a mentally-challenged person on-line new to Linux. He doesn't know what distribution he has. I found a page that pointed me to /etc/issue , but mine doesn't have the distribution named in it. /etc/os-release does, but is it universal? I use Slackware.

frankbell 12-19-2019 09:25 PM

Code:

cat /etc/*release*
It's sort of a catchall, but it usually works.

jefro 12-19-2019 09:34 PM

Every once in a while you can get information from uname -a on some specific kernels.

mrmazda 12-19-2019 11:50 PM

Quote:

Originally Posted by RandomTroll (Post 6069649)
.../etc/os-release...is it universal?

It was intended to be. I don't remember seeing it absent in a very long time.

FlinchX 12-20-2019 11:04 PM

The shell script VBoxSysInfo.sh that is part of VirtualBox has a bit of logic related to detecting the distro, maybe that can be helpful.

dugan 12-20-2019 11:22 PM

lsb_release sometimes works.

baggister 12-21-2019 05:14 AM

Quote:

Originally Posted by RandomTroll (Post 6069649)
I'm trying to help a mentally-challenged person on-line new to Linux. He doesn't know what distribution he has. I found a page that pointed me to /etc/issue , but mine doesn't have the distribution named in it. /etc/os-release does, but is it universal? I use Slackware.

Surely there has to be something fundamentally missing with any or all distributions if there isn't a common simple way to identify the distro in the first place.

Come on distro writers, take that pen out of your @ss and add an ABOUT to the start menu.

JeremyBoden 12-21-2019 07:42 AM

I find that
Code:

inxi -b
gives the distribution (and considerably more information).
Of course its possible that you will need to install the inxi package first...

teckk 12-21-2019 07:54 AM

Quote:

if there isn't a common simple way to identify the distro in the first place.
Somebody had to install that. They don't know what they installed?
Or if bought that way, the description should have told what it was.

Or if your buddy installed it and then gave it to you, give it back. What a horrible holiday present. Hey here's an Arch linux machine I made for you. Here's the web site and the wiki url. You're on your own...

Quote:

Come on distro writers
They are not there to serve you. They have made a distro that they want to use, 1000's of hours of work, open sourced it, so that you can use it too if you want to. Free of charge, modify it how you wish.

Now, if you are using Redhat, and paying for it, then call them on the phone and demand support.

https://www.tecmint.com/commands-to-...tion-in-linux/

dugan 12-21-2019 08:47 AM

Quote:

Originally Posted by baggister (Post 6070044)
Surely there has to be something fundamentally missing with any or all distributions if there isn't a common simple way to identify the distro in the first place.

Come on distro writers, take that pen out of your @ss and add an ABOUT to the start menu.

This... isn't as simple as you make it sound.

https://xkcd.com/927/

tofino_surfer 12-21-2019 08:59 AM

A more sophisticated formatted output compared to post #2 cat /etc/*release*, which separates the output with file name headers, blank lines and separators, can be obtained by using:

Code:

$ for f in /etc/*release*; do echo -e "File $f:\n"; cat $f; echo "----------"; done
When I run this on Fedora 30 I get:

Code:

$ for f in /etc/*release*; do echo -e "File $f:\n"; cat $f; echo "----------"; done
File /etc/fedora-release:

Fedora release 30 (Thirty)
----------
File /etc/os-release:

NAME=Fedora
VERSION="30 (Thirty)"
ID=fedora
VERSION_ID=30
VERSION_CODENAME=""
PLATFORM_ID="platform:f30"
PRETTY_NAME="Fedora 30 (Thirty)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:30"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f30/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=30
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=30
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"
----------
File /etc/redhat-release:

Fedora release 30 (Thirty)
----------
File /etc/system-release:

Fedora release 30 (Thirty)
----------
File /etc/system-release-cpe:

cpe:/o:fedoraproject:fedora:30
----------

As every distribution has different /etc/*release* files this will display all that exist on a given system separated by headers and formatting.

dugan 12-21-2019 09:19 AM

Quote:

Originally Posted by RandomTroll (Post 6069649)
/etc/os-release does, but is it universal? I use Slackware.

Well, it's a systemd thing and it's in Slackware. Sounds universal to me.

http://0pointer.de/blog/projects/os-release

https://www.freedesktop.org/software...s-release.html

JeremyBoden 12-21-2019 09:46 AM

Quote:

Originally Posted by tofino_surfer (Post 6070092)
A more sophisticated formatted output, which separates the output with file name headers and blank lines, can be obtained by using:

Code:

$ for f in /etc/*release*; do echo -e "$f:\n"; cat $f; echo ""; done

Well not that sophisticated:) - I tried it and got:-
Quote:

for f in /etc/*release*; do echo -e "$f:\n"; cat $f; echo ""; done
/etc/lsb-release:

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=3
DISTRIB_CODENAME=cindy
DISTRIB_DESCRIPTION="LMDE 3 Cindy"
/etc/lsb-release.dpkg-old:

DISTRIB_ID=LinuxMint
DISTRIB_RELEASE=2
DISTRIB_CODENAME=betsy
DISTRIB_DESCRIPTION="LMDE 2 Betsy"

/etc/os-release:

PRETTY_NAME="Linux Mint LMDE"
NAME="Linux Mint LMDE"
ID=linuxmint
ANSI_COLOR="1;31"
The True answer is
Quote:

DISTRIB_CODENAME=cindy
DISTRIB_DESCRIPTION="LMDE 3 Cindy"

tofino_surfer 12-21-2019 10:06 AM

Quote:

Well not that sophisticated - I tried it and got:-
This is exactly what it's supposed to do, print a header for each file name and have the output separated by blank lines. What were you expecting ? I was comparing it to the earlier post #2

Code:

cat /etc/*release*
which simply dumps all output together in one block without telling which output comes from which file or even separating the output with blank lines.

Quote:

The True answer is

DISTRIB_CODENAME=cindy
DISTRIB_DESCRIPTION="LMDE 3 Cindy"
You don't seem to understand this but this is only from the lsb-release file. I use Fedora and don't have this file.

Code:

$ for f in /etc/*release*; do echo -e "$f:\n"; cat $f; echo ""; done
/etc/fedora-release:

Fedora release 30 (Thirty)

/etc/os-release:

NAME=Fedora
VERSION="30 (Thirty)"
ID=fedora
VERSION_ID=30
VERSION_CODENAME=""
PLATFORM_ID="platform:f30"
PRETTY_NAME="Fedora 30 (Thirty)"
ANSI_COLOR="0;34"
LOGO=fedora-logo-icon
CPE_NAME="cpe:/o:fedoraproject:fedora:30"
HOME_URL="https://fedoraproject.org/"
DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f30/system-administrators-guide/"
SUPPORT_URL="https://fedoraproject.org/wiki/Communicating_and_getting_help"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Fedora"
REDHAT_BUGZILLA_PRODUCT_VERSION=30
REDHAT_SUPPORT_PRODUCT="Fedora"
REDHAT_SUPPORT_PRODUCT_VERSION=30
PRIVACY_POLICY_URL="https://fedoraproject.org/wiki/Legal:PrivacyPolicy"

/etc/redhat-release:

Fedora release 30 (Thirty)

/etc/system-release:

Fedora release 30 (Thirty)

/etc/system-release-cpe:

cpe:/o:fedoraproject:fedora:30

There is no lsb-release file on Fedora and no DISTRIB_CODENAME or DISTRIB_DESCRIPTION anywhere. Your "True answer" doesn't work for Fedora/RH users and likely many other distributions.

Since you don't know what distribution the OP uses or any one else reading this post your "True answer" is meaningless.

My recommendation simply lists and formats all of the available output that actually does exist on a given system.

mrmazda 12-21-2019 11:28 AM

I usually just "grep RETT /etc/*lease", unless mc is installed, in which case I just F3 /etc/os-release.


All times are GMT -5. The time now is 12:15 AM.