I'd like to be able to detect which particular Linux flavor is installed on a computer, e.g., Ubuntu vs. Fedora, via a command line command.
Some people recommend uname -a, but that only reports the kernel version.
I'd like to be able to detect which particular Linux flavor is installed on a computer, e.g., Ubuntu vs. Fedora, via a command line command.
Some people recommend uname -a, but that only reports the kernel version.
Try the below command.... It worked for me...
cat /proc/version Once you know that you are running Red Hat for example, you can get to the point with:
cat /etc/redhat-release Or on Debian:
cat /etc/debian_version or in general :
cat /etc/*-release Also you could use the following command
cat /etc/issue For displaying details including release and codename of the distro
lsb_release -a cat /etc/os-release work?cat /etc/os-release is the command that worked for me. It displays information in the following format:
NAME="Linux Mint" VERSION="21.1 (Vera)" ID=linuxmint ID_LIKE="ubuntu debian" PRETTY_NAME="Linux Mint 21.1" VERSION_ID="21.1" HOME_URL="https://www.linuxmint.com/" SUPPORT_URL="https://forums.linuxmint.com/" BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" PRIVACY_POLICY_URL="https://www.linuxmint.com/" VERSION_CODENAME=vera UBUNTU_CODENAME=jammy As ddelange and Stuart mentioned in the comments, you can also use it like this:
source /etc/os-release && echo $UBUNTU_CODENAME
which outputs:
jammy
and source /etc/os-release && echo $ID_LIKE
which outputs:
ubuntu debian
source /etc/os-release && echo $UBUNTU_CODENAME$ID_LIKE seems reliable for the flavourYou can try:
echo $(lsb_release -si) echo a subshell output, isn't that redundant?lsb_release -si, echo is uselessTry hostnamectl. It lists the operating system, CPE OS Name, Kernel, Architecture, etc.