Check Linux OS Version in Terminal
There are a few ways to check your kernel and linux os version, but today we will cover some commands to do this in a terminal.
Knowing how to check your kernel and linux os version in a terminal can be useful if you ever need help in a forum where they might ask for this information. You can also use this info in a bash script to determine what actions to take in your script based on the kernel and linux os version. Whatever the case may be, it’s a good idea to get familiar with these commands.
Linux OS Version
Get Linux Standard Base info:
lsb_release -aOutput:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.3 LTS
Release: 18.04
Codename: bionicOr:
cat /etc/lsb-releaseOutput:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"Get Linux Standard Base version only:
lsb_release -rOutput:
Release: 18.04Get full Linux OS information:
cat /etc/*releaseOutput:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 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=bionicOr:
cat /etc/os-releaseOutput:
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 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=bionicA few more system details:
hostnamectlOutput:
Static hostname: ubuntu
Icon name: computer-desktop
Chassis: desktop
Machine ID: 76b1059e1a6c4453b277aa20f39b4bca
Boot ID: e936fa2f2f9e4f56a6176921a76acdb8
Operating System: Ubuntu 18.04.3 LTS
Kernel: Linux 5.0.0-32-generic
Architecture: x86-64Kernel Version
Print the kernel version:
uname -rOutput:
5.0.0-32-genericPrint the kernel version and instruction set:
uname -mrsOutput:
Linux 5.0.0-32-generic x86_64Print all kernel information:
uname -aOutput:
Linux ubuntu 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/LinuxAdditional kernel information:
cat /proc/versionOutput:
Linux version 5.0.0-32-generic (buildd@lgw01-amd64-015) (gcc version 7.4.0 (Ubuntu 7.4.0-1ubuntu1~18.04.1)) #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019OS type, kernel release number, and version:
cat /proc/sys/kernel/{ostype,osrelease,version}Output:
Linux
5.0.0-32-generic
#34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019Conclusion
This concludes our look at how to check your kernel and Linux OS version in terminal. You now know a few ways to obtain the kernel and linux OS information for any situation.
Tags: tutorials, linux, command line