In our day to day life, sometimes it is required that we need to check the version of Operating System we are using. For example, If we need to install a software, we need to check whether our current OS supports that particular version or not.
In Windows It is easy to check, as it is entirely GUI based OS. However, in Operating Systems like Linux/Unix, where we prefer to use Command line instead of the GUI, it is difficult to remember all the commands.
In this post we are going to see How to check the Operating System details we are using in Linux, in 3 Simple methods. There are several ways we can check, but, below are the easy way to check the Linux OS version and OS details easily.
Linux Command to Check the OS Version and details
Using os-release file available in Linux’s etc directory
You can run below command to view the file, which contains Linux Operating System (OS) info
~$ cat /etc/os-release
output of above
NAME="Ubuntu" VERSION="18.04.4 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.4 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic
Using lsb_release command
We can get the Linux OS info using lsb_release command. LSB Stands for Linux Standard Base
$ lsb_release -a
Output of lsb_release command is
~$ lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 18.04.4 LTS Release: 18.04 Codename: bionic
Using version file available in Linux’s proc directory
Same like os-release, we can use below command to view the version file
~$ cat /proc/version
output of above cat command is
~$ cat /proc/version Linux version 4.15.0-1037-gcp (buildd@lgw01-amd64-031) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #39-Ubuntu SMP Wed Jul 3 06:28:59 UTC 2019
Above are my preferred methods to get the Linux OS details in simple and easy way.
What is your best command to get the OS details? mention them in comments below.