How to find Linux Distribution name using shell script?
$ lsb_release -iDistributor ID: Fedora$ lsb_release -i | cut -f 2-Fedora
You can get the info from lsb_release
:
echo "$(lsb_release -is)"
i
stands for distributor id.
s
stands for short.
For ex. It shows Ubuntu
instead of Distributor Id: Ubuntu
There are other options:
-r : release
-d : description
-c : codename
-a : all
You can get this information by running lsb_release --help
or man lsb_release
try this one:
awk '/^ID=/' /etc/*-release | awk -F'=' '{ print tolower($2) }'