How do I find out what version of Linux I'm running?












199















Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?










share|improve this question





























    199















    Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?










    share|improve this question



























      199












      199








      199


      79






      Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?










      share|improve this question
















      Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?







      linux command-line version






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 2 '11 at 14:03









      Breakthrough

      31.4k992138




      31.4k992138










      asked Jul 22 '09 at 19:20









      Daryl SpitzerDaryl Spitzer

      3,940103536




      3,940103536






















          9 Answers
          9






          active

          oldest

          votes


















          262














          The kernel is universally detected with uname:



          $ uname -or
          2.6.18-128.el5 GNU/Linux


          There really isn't a cross-distribution way to determine what distribution and version you're on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:



          $ lsb_release -irc
          Distributor ID: Ubuntu
          Release: 9.04
          Codename: jaunty


          Otherwise, the closest widely-available method is checking /etc/something-release files. These exist on most of the common platforms, and on their derivatives (i.e., Red Hat and CentOS).



          Here are some examples.



          Ubuntu has /etc/lsb-release:



          $ cat /etc/lsb-release
          DISTRIB_ID=Ubuntu
          DISTRIB_RELEASE=9.04
          DISTRIB_CODENAME=jaunty
          DISTRIB_DESCRIPTION="Ubuntu 9.04"


          But Debian has /etc/debian_version:



          $ cat /etc/debian_version
          5.0.2


          Fedora, Red Hat and CentOS have:



          Fedora: $ cat /etc/fedora-release
          Fedora release 10 (Cambridge)

          Red Hat/older CentOS: $ cat /etc/redhat-release
          CentOS release 5.3 (Final)

          newer CentOS: $ cat /etc/centos-release
          CentOS Linux release 7.1.1503 (Core)


          Gentoo:



          $ cat /etc/gentoo-release
          Gentoo Base System release 1.12.11.1


          I don't have a SUSE system available at the moment, but I believe it is /etc/SuSE-release.



          Slackware has /etc/slackware-release and/or /etc/slackware-version.



          Mandriva has /etc/mandriva-release.



          For most of the popular distributions then,



          $ cat /etc/*{release,version}


          will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.



          Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.



          Note that many distributions have this kind of information in /etc/issue or /etc/motd, but some security policies and best practices indicate that these files should contain access notification banners.



          Related:
          How to find out version of software package installed on the node?,
          puppet.






          share|improve this answer





















          • 3





            Lol here I was thinking to suggest: look for About!

            – Ivo Flipse
            Jul 22 '09 at 19:40






          • 2





            Slackware has /etc/slackware-version

            – Ken Keenan
            Jul 22 '09 at 19:45











          • Thanks Ken, I don't have a slackware system either.

            – jtimberman
            Jul 22 '09 at 19:56






          • 4





            IOW: ls /etc/*{release,version} and examine whatever comes back...

            – freiheit
            Jul 22 '09 at 20:11






          • 1





            Most also have /etc/issue

            – Drew Stephens
            Jul 23 '09 at 6:42



















          39














          You could also try:



          $ cat /etc/issue


          It usually (not always, though) will tell you what distribution you are using. /etc/issue is the file used for the login screen.






          share|improve this answer





















          • 2





            This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

            – TryTryAgain
            Feb 8 '13 at 18:03






          • 2





            Ha, on RedHat, that's just S[newline]Kernel r on an m

            – ruffin
            Feb 2 '15 at 20:21



















          19














          Kernel: uname -a






          share|improve this answer
























          • +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

            – Peter Mortensen
            May 2 '12 at 8:39





















          15














          cat /etc/os-release


          at a minimum for Ubuntu, Fedora and OpenSUSE.



          Does not work for OS X at least until 10.9 (Mavericks). Use sw_vers instead.



          OpenSUSE had cat /etc/SuSE-release up until 13.1 but is deprecated in favour of os-release.



          Redhat 6.1 has cat /etc/redhat-release






          share|improve this answer





















          • 1





            DOC: freedesktop.org/software/systemd/man/os-release.html

            – pevik
            Nov 3 '16 at 8:55



















          14














          lsb_release -a, when available, is useful.






          share|improve this answer































            10














            cat /proc/version found me Red Hat on a shared VPS.






            share|improve this answer































              6














              Kernel: uname -r



              Distro: lsb_release -a



              These will run on most Linux systems






              share|improve this answer































                4














                One-liner



                lsb_release -a && uname -r





                share|improve this answer



















                • 1





                  This might be more appropriate as a comment on Albert Z's answer.

                  – fixer1234
                  Jan 29 '18 at 21:52






                • 1





                  mighty answer to conclude all answers! I must upvote for the effort :)

                  – user_balaz
                  Mar 27 '18 at 13:17





















                1














                This issue can also be solved using Python with the platform module:



                Using platform() function:



                python -c 'import platform; print platform.platform()'
                # Linux-4.9.0-8-amd64-x86_64-with-debian-9.6


                The above command returns a single string identifying the underlying platform with as much useful information as possible.



                Or using uname() function:



                python -c 'import platform; print platform.uname()'
                # ('Linux', 'debian', '4.9.0-8-amd64', '#1 SMP Debian 4.9.130-2 (2018-10-27)', 'x86_64', '')


                The above command returns a namedtuple() containing six attributes: system, node, release, version, machine, and processor.



                Or using dist() function:



                python -c 'import platform; print platform.dist()'
                # ('debian', '9.6', '')


                The last command tries to determine the name of the Linux OS distribution name, but it is deprecated since Python 3.5 and will be removed in Python 3.8.






                share|improve this answer

































                  9 Answers
                  9






                  active

                  oldest

                  votes








                  9 Answers
                  9






                  active

                  oldest

                  votes









                  active

                  oldest

                  votes






                  active

                  oldest

                  votes









                  262














                  The kernel is universally detected with uname:



                  $ uname -or
                  2.6.18-128.el5 GNU/Linux


                  There really isn't a cross-distribution way to determine what distribution and version you're on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:



                  $ lsb_release -irc
                  Distributor ID: Ubuntu
                  Release: 9.04
                  Codename: jaunty


                  Otherwise, the closest widely-available method is checking /etc/something-release files. These exist on most of the common platforms, and on their derivatives (i.e., Red Hat and CentOS).



                  Here are some examples.



                  Ubuntu has /etc/lsb-release:



                  $ cat /etc/lsb-release
                  DISTRIB_ID=Ubuntu
                  DISTRIB_RELEASE=9.04
                  DISTRIB_CODENAME=jaunty
                  DISTRIB_DESCRIPTION="Ubuntu 9.04"


                  But Debian has /etc/debian_version:



                  $ cat /etc/debian_version
                  5.0.2


                  Fedora, Red Hat and CentOS have:



                  Fedora: $ cat /etc/fedora-release
                  Fedora release 10 (Cambridge)

                  Red Hat/older CentOS: $ cat /etc/redhat-release
                  CentOS release 5.3 (Final)

                  newer CentOS: $ cat /etc/centos-release
                  CentOS Linux release 7.1.1503 (Core)


                  Gentoo:



                  $ cat /etc/gentoo-release
                  Gentoo Base System release 1.12.11.1


                  I don't have a SUSE system available at the moment, but I believe it is /etc/SuSE-release.



                  Slackware has /etc/slackware-release and/or /etc/slackware-version.



                  Mandriva has /etc/mandriva-release.



                  For most of the popular distributions then,



                  $ cat /etc/*{release,version}


                  will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.



                  Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.



                  Note that many distributions have this kind of information in /etc/issue or /etc/motd, but some security policies and best practices indicate that these files should contain access notification banners.



                  Related:
                  How to find out version of software package installed on the node?,
                  puppet.






                  share|improve this answer





















                  • 3





                    Lol here I was thinking to suggest: look for About!

                    – Ivo Flipse
                    Jul 22 '09 at 19:40






                  • 2





                    Slackware has /etc/slackware-version

                    – Ken Keenan
                    Jul 22 '09 at 19:45











                  • Thanks Ken, I don't have a slackware system either.

                    – jtimberman
                    Jul 22 '09 at 19:56






                  • 4





                    IOW: ls /etc/*{release,version} and examine whatever comes back...

                    – freiheit
                    Jul 22 '09 at 20:11






                  • 1





                    Most also have /etc/issue

                    – Drew Stephens
                    Jul 23 '09 at 6:42
















                  262














                  The kernel is universally detected with uname:



                  $ uname -or
                  2.6.18-128.el5 GNU/Linux


                  There really isn't a cross-distribution way to determine what distribution and version you're on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:



                  $ lsb_release -irc
                  Distributor ID: Ubuntu
                  Release: 9.04
                  Codename: jaunty


                  Otherwise, the closest widely-available method is checking /etc/something-release files. These exist on most of the common platforms, and on their derivatives (i.e., Red Hat and CentOS).



                  Here are some examples.



                  Ubuntu has /etc/lsb-release:



                  $ cat /etc/lsb-release
                  DISTRIB_ID=Ubuntu
                  DISTRIB_RELEASE=9.04
                  DISTRIB_CODENAME=jaunty
                  DISTRIB_DESCRIPTION="Ubuntu 9.04"


                  But Debian has /etc/debian_version:



                  $ cat /etc/debian_version
                  5.0.2


                  Fedora, Red Hat and CentOS have:



                  Fedora: $ cat /etc/fedora-release
                  Fedora release 10 (Cambridge)

                  Red Hat/older CentOS: $ cat /etc/redhat-release
                  CentOS release 5.3 (Final)

                  newer CentOS: $ cat /etc/centos-release
                  CentOS Linux release 7.1.1503 (Core)


                  Gentoo:



                  $ cat /etc/gentoo-release
                  Gentoo Base System release 1.12.11.1


                  I don't have a SUSE system available at the moment, but I believe it is /etc/SuSE-release.



                  Slackware has /etc/slackware-release and/or /etc/slackware-version.



                  Mandriva has /etc/mandriva-release.



                  For most of the popular distributions then,



                  $ cat /etc/*{release,version}


                  will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.



                  Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.



                  Note that many distributions have this kind of information in /etc/issue or /etc/motd, but some security policies and best practices indicate that these files should contain access notification banners.



                  Related:
                  How to find out version of software package installed on the node?,
                  puppet.






                  share|improve this answer





















                  • 3





                    Lol here I was thinking to suggest: look for About!

                    – Ivo Flipse
                    Jul 22 '09 at 19:40






                  • 2





                    Slackware has /etc/slackware-version

                    – Ken Keenan
                    Jul 22 '09 at 19:45











                  • Thanks Ken, I don't have a slackware system either.

                    – jtimberman
                    Jul 22 '09 at 19:56






                  • 4





                    IOW: ls /etc/*{release,version} and examine whatever comes back...

                    – freiheit
                    Jul 22 '09 at 20:11






                  • 1





                    Most also have /etc/issue

                    – Drew Stephens
                    Jul 23 '09 at 6:42














                  262












                  262








                  262







                  The kernel is universally detected with uname:



                  $ uname -or
                  2.6.18-128.el5 GNU/Linux


                  There really isn't a cross-distribution way to determine what distribution and version you're on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:



                  $ lsb_release -irc
                  Distributor ID: Ubuntu
                  Release: 9.04
                  Codename: jaunty


                  Otherwise, the closest widely-available method is checking /etc/something-release files. These exist on most of the common platforms, and on their derivatives (i.e., Red Hat and CentOS).



                  Here are some examples.



                  Ubuntu has /etc/lsb-release:



                  $ cat /etc/lsb-release
                  DISTRIB_ID=Ubuntu
                  DISTRIB_RELEASE=9.04
                  DISTRIB_CODENAME=jaunty
                  DISTRIB_DESCRIPTION="Ubuntu 9.04"


                  But Debian has /etc/debian_version:



                  $ cat /etc/debian_version
                  5.0.2


                  Fedora, Red Hat and CentOS have:



                  Fedora: $ cat /etc/fedora-release
                  Fedora release 10 (Cambridge)

                  Red Hat/older CentOS: $ cat /etc/redhat-release
                  CentOS release 5.3 (Final)

                  newer CentOS: $ cat /etc/centos-release
                  CentOS Linux release 7.1.1503 (Core)


                  Gentoo:



                  $ cat /etc/gentoo-release
                  Gentoo Base System release 1.12.11.1


                  I don't have a SUSE system available at the moment, but I believe it is /etc/SuSE-release.



                  Slackware has /etc/slackware-release and/or /etc/slackware-version.



                  Mandriva has /etc/mandriva-release.



                  For most of the popular distributions then,



                  $ cat /etc/*{release,version}


                  will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.



                  Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.



                  Note that many distributions have this kind of information in /etc/issue or /etc/motd, but some security policies and best practices indicate that these files should contain access notification banners.



                  Related:
                  How to find out version of software package installed on the node?,
                  puppet.






                  share|improve this answer















                  The kernel is universally detected with uname:



                  $ uname -or
                  2.6.18-128.el5 GNU/Linux


                  There really isn't a cross-distribution way to determine what distribution and version you're on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren't installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:



                  $ lsb_release -irc
                  Distributor ID: Ubuntu
                  Release: 9.04
                  Codename: jaunty


                  Otherwise, the closest widely-available method is checking /etc/something-release files. These exist on most of the common platforms, and on their derivatives (i.e., Red Hat and CentOS).



                  Here are some examples.



                  Ubuntu has /etc/lsb-release:



                  $ cat /etc/lsb-release
                  DISTRIB_ID=Ubuntu
                  DISTRIB_RELEASE=9.04
                  DISTRIB_CODENAME=jaunty
                  DISTRIB_DESCRIPTION="Ubuntu 9.04"


                  But Debian has /etc/debian_version:



                  $ cat /etc/debian_version
                  5.0.2


                  Fedora, Red Hat and CentOS have:



                  Fedora: $ cat /etc/fedora-release
                  Fedora release 10 (Cambridge)

                  Red Hat/older CentOS: $ cat /etc/redhat-release
                  CentOS release 5.3 (Final)

                  newer CentOS: $ cat /etc/centos-release
                  CentOS Linux release 7.1.1503 (Core)


                  Gentoo:



                  $ cat /etc/gentoo-release
                  Gentoo Base System release 1.12.11.1


                  I don't have a SUSE system available at the moment, but I believe it is /etc/SuSE-release.



                  Slackware has /etc/slackware-release and/or /etc/slackware-version.



                  Mandriva has /etc/mandriva-release.



                  For most of the popular distributions then,



                  $ cat /etc/*{release,version}


                  will most often work. Stripped down and barebones "server" installations might not have the 'release' package for the distribution installed.



                  Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.



                  Note that many distributions have this kind of information in /etc/issue or /etc/motd, but some security policies and best practices indicate that these files should contain access notification banners.



                  Related:
                  How to find out version of software package installed on the node?,
                  puppet.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited May 23 '17 at 12:41









                  Community

                  1




                  1










                  answered Jul 22 '09 at 19:34









                  jtimbermanjtimberman

                  18.4k86076




                  18.4k86076








                  • 3





                    Lol here I was thinking to suggest: look for About!

                    – Ivo Flipse
                    Jul 22 '09 at 19:40






                  • 2





                    Slackware has /etc/slackware-version

                    – Ken Keenan
                    Jul 22 '09 at 19:45











                  • Thanks Ken, I don't have a slackware system either.

                    – jtimberman
                    Jul 22 '09 at 19:56






                  • 4





                    IOW: ls /etc/*{release,version} and examine whatever comes back...

                    – freiheit
                    Jul 22 '09 at 20:11






                  • 1





                    Most also have /etc/issue

                    – Drew Stephens
                    Jul 23 '09 at 6:42














                  • 3





                    Lol here I was thinking to suggest: look for About!

                    – Ivo Flipse
                    Jul 22 '09 at 19:40






                  • 2





                    Slackware has /etc/slackware-version

                    – Ken Keenan
                    Jul 22 '09 at 19:45











                  • Thanks Ken, I don't have a slackware system either.

                    – jtimberman
                    Jul 22 '09 at 19:56






                  • 4





                    IOW: ls /etc/*{release,version} and examine whatever comes back...

                    – freiheit
                    Jul 22 '09 at 20:11






                  • 1





                    Most also have /etc/issue

                    – Drew Stephens
                    Jul 23 '09 at 6:42








                  3




                  3





                  Lol here I was thinking to suggest: look for About!

                  – Ivo Flipse
                  Jul 22 '09 at 19:40





                  Lol here I was thinking to suggest: look for About!

                  – Ivo Flipse
                  Jul 22 '09 at 19:40




                  2




                  2





                  Slackware has /etc/slackware-version

                  – Ken Keenan
                  Jul 22 '09 at 19:45





                  Slackware has /etc/slackware-version

                  – Ken Keenan
                  Jul 22 '09 at 19:45













                  Thanks Ken, I don't have a slackware system either.

                  – jtimberman
                  Jul 22 '09 at 19:56





                  Thanks Ken, I don't have a slackware system either.

                  – jtimberman
                  Jul 22 '09 at 19:56




                  4




                  4





                  IOW: ls /etc/*{release,version} and examine whatever comes back...

                  – freiheit
                  Jul 22 '09 at 20:11





                  IOW: ls /etc/*{release,version} and examine whatever comes back...

                  – freiheit
                  Jul 22 '09 at 20:11




                  1




                  1





                  Most also have /etc/issue

                  – Drew Stephens
                  Jul 23 '09 at 6:42





                  Most also have /etc/issue

                  – Drew Stephens
                  Jul 23 '09 at 6:42













                  39














                  You could also try:



                  $ cat /etc/issue


                  It usually (not always, though) will tell you what distribution you are using. /etc/issue is the file used for the login screen.






                  share|improve this answer





















                  • 2





                    This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

                    – TryTryAgain
                    Feb 8 '13 at 18:03






                  • 2





                    Ha, on RedHat, that's just S[newline]Kernel r on an m

                    – ruffin
                    Feb 2 '15 at 20:21
















                  39














                  You could also try:



                  $ cat /etc/issue


                  It usually (not always, though) will tell you what distribution you are using. /etc/issue is the file used for the login screen.






                  share|improve this answer





















                  • 2





                    This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

                    – TryTryAgain
                    Feb 8 '13 at 18:03






                  • 2





                    Ha, on RedHat, that's just S[newline]Kernel r on an m

                    – ruffin
                    Feb 2 '15 at 20:21














                  39












                  39








                  39







                  You could also try:



                  $ cat /etc/issue


                  It usually (not always, though) will tell you what distribution you are using. /etc/issue is the file used for the login screen.






                  share|improve this answer















                  You could also try:



                  $ cat /etc/issue


                  It usually (not always, though) will tell you what distribution you are using. /etc/issue is the file used for the login screen.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Jan 8 at 8:08









                  simhumileco

                  252210




                  252210










                  answered Jul 22 '09 at 19:58









                  Pablo Santa CruzPablo Santa Cruz

                  1,3651421




                  1,3651421








                  • 2





                    This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

                    – TryTryAgain
                    Feb 8 '13 at 18:03






                  • 2





                    Ha, on RedHat, that's just S[newline]Kernel r on an m

                    – ruffin
                    Feb 2 '15 at 20:21














                  • 2





                    This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

                    – TryTryAgain
                    Feb 8 '13 at 18:03






                  • 2





                    Ha, on RedHat, that's just S[newline]Kernel r on an m

                    – ruffin
                    Feb 2 '15 at 20:21








                  2




                  2





                  This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

                  – TryTryAgain
                  Feb 8 '13 at 18:03





                  This is the only one that nailed it for me on a shared Media Temple server. Thanks!!

                  – TryTryAgain
                  Feb 8 '13 at 18:03




                  2




                  2





                  Ha, on RedHat, that's just S[newline]Kernel r on an m

                  – ruffin
                  Feb 2 '15 at 20:21





                  Ha, on RedHat, that's just S[newline]Kernel r on an m

                  – ruffin
                  Feb 2 '15 at 20:21











                  19














                  Kernel: uname -a






                  share|improve this answer
























                  • +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

                    – Peter Mortensen
                    May 2 '12 at 8:39


















                  19














                  Kernel: uname -a






                  share|improve this answer
























                  • +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

                    – Peter Mortensen
                    May 2 '12 at 8:39
















                  19












                  19








                  19







                  Kernel: uname -a






                  share|improve this answer













                  Kernel: uname -a







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 22 '09 at 19:21









                  raspiraspi

                  7861823




                  7861823













                  • +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

                    – Peter Mortensen
                    May 2 '12 at 8:39





















                  • +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

                    – Peter Mortensen
                    May 2 '12 at 8:39



















                  +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

                  – Peter Mortensen
                  May 2 '12 at 8:39







                  +1. For similar systems, like MinGW, the "-a" is required to get the version information, for example, "MINGW32_NT-5.1 LAP065 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys".

                  – Peter Mortensen
                  May 2 '12 at 8:39













                  15














                  cat /etc/os-release


                  at a minimum for Ubuntu, Fedora and OpenSUSE.



                  Does not work for OS X at least until 10.9 (Mavericks). Use sw_vers instead.



                  OpenSUSE had cat /etc/SuSE-release up until 13.1 but is deprecated in favour of os-release.



                  Redhat 6.1 has cat /etc/redhat-release






                  share|improve this answer





















                  • 1





                    DOC: freedesktop.org/software/systemd/man/os-release.html

                    – pevik
                    Nov 3 '16 at 8:55
















                  15














                  cat /etc/os-release


                  at a minimum for Ubuntu, Fedora and OpenSUSE.



                  Does not work for OS X at least until 10.9 (Mavericks). Use sw_vers instead.



                  OpenSUSE had cat /etc/SuSE-release up until 13.1 but is deprecated in favour of os-release.



                  Redhat 6.1 has cat /etc/redhat-release






                  share|improve this answer





















                  • 1





                    DOC: freedesktop.org/software/systemd/man/os-release.html

                    – pevik
                    Nov 3 '16 at 8:55














                  15












                  15








                  15







                  cat /etc/os-release


                  at a minimum for Ubuntu, Fedora and OpenSUSE.



                  Does not work for OS X at least until 10.9 (Mavericks). Use sw_vers instead.



                  OpenSUSE had cat /etc/SuSE-release up until 13.1 but is deprecated in favour of os-release.



                  Redhat 6.1 has cat /etc/redhat-release






                  share|improve this answer















                  cat /etc/os-release


                  at a minimum for Ubuntu, Fedora and OpenSUSE.



                  Does not work for OS X at least until 10.9 (Mavericks). Use sw_vers instead.



                  OpenSUSE had cat /etc/SuSE-release up until 13.1 but is deprecated in favour of os-release.



                  Redhat 6.1 has cat /etc/redhat-release







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Mar 9 '17 at 13:05









                  anatoly techtonik

                  163112




                  163112










                  answered Apr 2 '14 at 22:56









                  sweetfasweetfa

                  27125




                  27125








                  • 1





                    DOC: freedesktop.org/software/systemd/man/os-release.html

                    – pevik
                    Nov 3 '16 at 8:55














                  • 1





                    DOC: freedesktop.org/software/systemd/man/os-release.html

                    – pevik
                    Nov 3 '16 at 8:55








                  1




                  1





                  DOC: freedesktop.org/software/systemd/man/os-release.html

                  – pevik
                  Nov 3 '16 at 8:55





                  DOC: freedesktop.org/software/systemd/man/os-release.html

                  – pevik
                  Nov 3 '16 at 8:55











                  14














                  lsb_release -a, when available, is useful.






                  share|improve this answer




























                    14














                    lsb_release -a, when available, is useful.






                    share|improve this answer


























                      14












                      14








                      14







                      lsb_release -a, when available, is useful.






                      share|improve this answer













                      lsb_release -a, when available, is useful.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 22 '09 at 23:48









                      CesarBCesarB

                      3,96512222




                      3,96512222























                          10














                          cat /proc/version found me Red Hat on a shared VPS.






                          share|improve this answer




























                            10














                            cat /proc/version found me Red Hat on a shared VPS.






                            share|improve this answer


























                              10












                              10








                              10







                              cat /proc/version found me Red Hat on a shared VPS.






                              share|improve this answer













                              cat /proc/version found me Red Hat on a shared VPS.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 26 '14 at 6:59









                              ionoiono

                              24428




                              24428























                                  6














                                  Kernel: uname -r



                                  Distro: lsb_release -a



                                  These will run on most Linux systems






                                  share|improve this answer




























                                    6














                                    Kernel: uname -r



                                    Distro: lsb_release -a



                                    These will run on most Linux systems






                                    share|improve this answer


























                                      6












                                      6








                                      6







                                      Kernel: uname -r



                                      Distro: lsb_release -a



                                      These will run on most Linux systems






                                      share|improve this answer













                                      Kernel: uname -r



                                      Distro: lsb_release -a



                                      These will run on most Linux systems







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 18 '15 at 17:06









                                      Albert Z.Albert Z.

                                      7615




                                      7615























                                          4














                                          One-liner



                                          lsb_release -a && uname -r





                                          share|improve this answer



















                                          • 1





                                            This might be more appropriate as a comment on Albert Z's answer.

                                            – fixer1234
                                            Jan 29 '18 at 21:52






                                          • 1





                                            mighty answer to conclude all answers! I must upvote for the effort :)

                                            – user_balaz
                                            Mar 27 '18 at 13:17


















                                          4














                                          One-liner



                                          lsb_release -a && uname -r





                                          share|improve this answer



















                                          • 1





                                            This might be more appropriate as a comment on Albert Z's answer.

                                            – fixer1234
                                            Jan 29 '18 at 21:52






                                          • 1





                                            mighty answer to conclude all answers! I must upvote for the effort :)

                                            – user_balaz
                                            Mar 27 '18 at 13:17
















                                          4












                                          4








                                          4







                                          One-liner



                                          lsb_release -a && uname -r





                                          share|improve this answer













                                          One-liner



                                          lsb_release -a && uname -r






                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Jan 29 '18 at 14:51









                                          Serge StroobandtSerge Stroobandt

                                          8841120




                                          8841120








                                          • 1





                                            This might be more appropriate as a comment on Albert Z's answer.

                                            – fixer1234
                                            Jan 29 '18 at 21:52






                                          • 1





                                            mighty answer to conclude all answers! I must upvote for the effort :)

                                            – user_balaz
                                            Mar 27 '18 at 13:17
















                                          • 1





                                            This might be more appropriate as a comment on Albert Z's answer.

                                            – fixer1234
                                            Jan 29 '18 at 21:52






                                          • 1





                                            mighty answer to conclude all answers! I must upvote for the effort :)

                                            – user_balaz
                                            Mar 27 '18 at 13:17










                                          1




                                          1





                                          This might be more appropriate as a comment on Albert Z's answer.

                                          – fixer1234
                                          Jan 29 '18 at 21:52





                                          This might be more appropriate as a comment on Albert Z's answer.

                                          – fixer1234
                                          Jan 29 '18 at 21:52




                                          1




                                          1





                                          mighty answer to conclude all answers! I must upvote for the effort :)

                                          – user_balaz
                                          Mar 27 '18 at 13:17







                                          mighty answer to conclude all answers! I must upvote for the effort :)

                                          – user_balaz
                                          Mar 27 '18 at 13:17













                                          1














                                          This issue can also be solved using Python with the platform module:



                                          Using platform() function:



                                          python -c 'import platform; print platform.platform()'
                                          # Linux-4.9.0-8-amd64-x86_64-with-debian-9.6


                                          The above command returns a single string identifying the underlying platform with as much useful information as possible.



                                          Or using uname() function:



                                          python -c 'import platform; print platform.uname()'
                                          # ('Linux', 'debian', '4.9.0-8-amd64', '#1 SMP Debian 4.9.130-2 (2018-10-27)', 'x86_64', '')


                                          The above command returns a namedtuple() containing six attributes: system, node, release, version, machine, and processor.



                                          Or using dist() function:



                                          python -c 'import platform; print platform.dist()'
                                          # ('debian', '9.6', '')


                                          The last command tries to determine the name of the Linux OS distribution name, but it is deprecated since Python 3.5 and will be removed in Python 3.8.






                                          share|improve this answer






























                                            1














                                            This issue can also be solved using Python with the platform module:



                                            Using platform() function:



                                            python -c 'import platform; print platform.platform()'
                                            # Linux-4.9.0-8-amd64-x86_64-with-debian-9.6


                                            The above command returns a single string identifying the underlying platform with as much useful information as possible.



                                            Or using uname() function:



                                            python -c 'import platform; print platform.uname()'
                                            # ('Linux', 'debian', '4.9.0-8-amd64', '#1 SMP Debian 4.9.130-2 (2018-10-27)', 'x86_64', '')


                                            The above command returns a namedtuple() containing six attributes: system, node, release, version, machine, and processor.



                                            Or using dist() function:



                                            python -c 'import platform; print platform.dist()'
                                            # ('debian', '9.6', '')


                                            The last command tries to determine the name of the Linux OS distribution name, but it is deprecated since Python 3.5 and will be removed in Python 3.8.






                                            share|improve this answer




























                                              1












                                              1








                                              1







                                              This issue can also be solved using Python with the platform module:



                                              Using platform() function:



                                              python -c 'import platform; print platform.platform()'
                                              # Linux-4.9.0-8-amd64-x86_64-with-debian-9.6


                                              The above command returns a single string identifying the underlying platform with as much useful information as possible.



                                              Or using uname() function:



                                              python -c 'import platform; print platform.uname()'
                                              # ('Linux', 'debian', '4.9.0-8-amd64', '#1 SMP Debian 4.9.130-2 (2018-10-27)', 'x86_64', '')


                                              The above command returns a namedtuple() containing six attributes: system, node, release, version, machine, and processor.



                                              Or using dist() function:



                                              python -c 'import platform; print platform.dist()'
                                              # ('debian', '9.6', '')


                                              The last command tries to determine the name of the Linux OS distribution name, but it is deprecated since Python 3.5 and will be removed in Python 3.8.






                                              share|improve this answer















                                              This issue can also be solved using Python with the platform module:



                                              Using platform() function:



                                              python -c 'import platform; print platform.platform()'
                                              # Linux-4.9.0-8-amd64-x86_64-with-debian-9.6


                                              The above command returns a single string identifying the underlying platform with as much useful information as possible.



                                              Or using uname() function:



                                              python -c 'import platform; print platform.uname()'
                                              # ('Linux', 'debian', '4.9.0-8-amd64', '#1 SMP Debian 4.9.130-2 (2018-10-27)', 'x86_64', '')


                                              The above command returns a namedtuple() containing six attributes: system, node, release, version, machine, and processor.



                                              Or using dist() function:



                                              python -c 'import platform; print platform.dist()'
                                              # ('debian', '9.6', '')


                                              The last command tries to determine the name of the Linux OS distribution name, but it is deprecated since Python 3.5 and will be removed in Python 3.8.







                                              share|improve this answer














                                              share|improve this answer



                                              share|improve this answer








                                              edited Jan 8 at 8:35

























                                              answered Jan 8 at 7:25









                                              simhumilecosimhumileco

                                              252210




                                              252210















                                                  Popular posts from this blog

                                                  flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

                                                  Mangá

                                                  Eduardo VII do Reino Unido