65

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.

mcandre
  • 22,868
  • 20
  • 88
  • 147
  • 1
    Possible duplicate of [Best way to find os name and version in Unix/Linux platform](https://stackoverflow.com/q/26988262/608639), [How to discover what Linux distribution is in use](https://stackoverflow.com/q/264290/608639), etc. – jww Oct 13 '18 at 04:52

6 Answers6

108

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
Kashyap
  • 15,354
  • 13
  • 64
  • 103
ramit girdhar
  • 2,272
  • 1
  • 25
  • 26
23

For displaying details including release and codename of the distro

lsb_release -a
Rag Sagar
  • 2,314
  • 1
  • 18
  • 21
3

You can try:

echo $(lsb_release -si)
vvvvv
  • 25,404
  • 19
  • 49
  • 81
Bhanu Kaushik
  • 876
  • 6
  • 25
2

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
Nav
  • 19,885
  • 27
  • 92
  • 135
0

Try hostnamectl. It lists the operating system, CPE OS Name, Kernel, Architecture, etc.

PR0M3TH3US
  • 13
  • 1
0

Use command to know the name of the os:

cat /etc/*-release 
Tyler2P
  • 2,324
  • 26
  • 22
  • 31