Determining Linux Distribution

Karel Gardas karel.gardas at centrum.cz
Wed Sep 9 21:03:34 UTC 2020


On 9/9/20 10:30 PM, Joel Sherrill wrote:
> It reports CentOS 7 as "centos"

Ubuntu 18.04 -> Ubuntu

and now in linux containers (if you are curious, but I would bet you get
the same result on local installed system too):

Ubuntu 20.04 -> Ubuntu
CentOS 8 -> centos
Debian 10 -> os
OpenSUSE 15.2 -> os
Alpine 3.12 -> alpine
Kali 2020.03 -> os

so Debian, Kali and OpenSuSE at least are not well handled by this
script and it's quite fun since simple:

cat /etc/os-release |grep "^ID="|cut -d '=' -f 2-

works on all of them above providing kind of meaningful answer:

Ubuntu 18.04 -> ubuntu
Ubuntu 20.04 -> ubuntu
CentOS 7 -> "centos"
CentOS 8 -> "centos"
Debian 10 -> debian
OpenSUSE 15.2 -> "opensuse-leap"
Alpine 3.12 -> alpine
Kali 2020.03 -> kali

Cheers,
Karel


More information about the devel mailing list