Is there a way to find out which Linux distribution is being used?

I would like to show the user some help with specific operations in my form program:

Type "apt-get install foobar" to install the foobar function.

Is there anything that can be done, or should I leave it to the user and suggest options from Red Hat, Suse, Debian / Ubuntu, Mandriva, Slackware, Gentoo ....

+3
source share
7 answers

cat / etc / lsb-release

root@pierr-desktop:~# cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=8.10
DISTRIB_CODENAME=intrepid
DISTRIB_DESCRIPTION="Ubuntu 8.10"
+6
source

lsb_release -a can help on debian and coined.

+5
source

, , Linux .

lsb_release, Linux. , , LSB- , LSB. (, , FritzBox, .)

, LSB, LSB-? , , LSB.

+3

cat /etc/issue

+2

, Linux , , , , , . lsb, LSB, .

/etc/dist -release. , /etc/arch -release, .

:

uname -a

, , . ​​Arch Linux Arch, , Gentoo "Gentoo Linux".

, apt-get, rpm, emerge, .

+2

You can do this for most well-known distributions (Redhat, Fedaora, Gentoo, Suse, Debian, Ubuntu), they have special files for identifying the distribution and version. those. /etc/debian_version.

But it would be a tedious task for you to list the entire package and everything, but if you really want to be friendly

0
source

try with cat:

cat / proc / version

but with uname it might be better:

uname -a
-1
source

Source: https://habr.com/ru/post/1721956/


All Articles