Probably at some point in your life you will be facing an unknown linux terminal where you have no idea what the distribution is, let alone the version… But then how do I find out which distribution/version I'm running?
TL;DR – You can use one of the following methods below:
- cat /etc/*-release
- lsb_release -a
- hostname
1. Using the /etc/*-release file
To find out your Linux version and other information, run the command cat below on your terminal:
$cat /etc/*-release
Example running on my desktop with Ubuntu :
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.04
DISTRIB_CODENAME=disk
DISTRIB_DESCRIPTION="Ubuntu 19.04"
NAME="Ubuntu"
VERSION="19.04 (Dingo Disc)"
id=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 19.04"
VERSION_ID="19.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=disk
UBUNTU_CODENAME=disk
two. Using the lsb_release command
The command lsb_release displays LSD (Linux Standard Base) and distro-specific information. Run the following command:
$lsb_release -a
Example of the result:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 19.04
Release: 19.04
codename: disk
3. Using the hostnamectl command
For distributions based on GNU systemd this is the best option:
$hostname
Example of the result:
Static hostname: *******
Icon name: computer-laptop
Chassis: laptop
Machine ID: 07c27ab13c7c49b59e53df8781de****
Boot ID: 77062197a37d45eeb656c889c7e5****
Operating System: Ubuntu 19.04
Kernel: Linux 5.0.0-16-generic
Architecture: x86-64
How do I find my Linux Kernel version?
Running one of the following commands
$uname -a
$uname -mrs
Example of the result:
Linux ****** 5.0.0-16-generic #17-Ubuntu SMP Wed May 15 10:52:21 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
- Linux – Kernel Name
- 5.0.0-16 – Kernel Version
- x86_64 – Architecture version (64 bit)