Home Linux Commands How to Find Linux Distribution Release Name and Version

How to Find Linux Distribution Release Name and Version

There are many commands in Linux to get the same information and one such command is the lsb_release, which is used to get the Linux distribution-related information such as OS name, code name, release information.

[ You might also like: How to Find Top Running Processes by Memory Usage ]

In some Linux distributions, the lsb_release command will be available to use and in some distributions, you have to install it, as this command is part of the LSB-core package.

Check Linux Distribution Information

To check if the lsb_release command is installed run the following command.

$ which lsb_release

/usr/bin/lsb_release 

In some distributions like Ubuntu, this command is already available to use but you will get the following error when you try to use some flags.

$ lsb_release -v

No LSB modules are available.

Install lsb-core in Linux Distributions

To fix this you need to install the lsb-core package. Depending upon the distribution you are using run the following commands to install the lsb-core package.

------- On Debian/Ubuntu ------- 
$ sudo apt-get update 
$ sudo apt-get install lsb-core
 
------- On Arch/Manjaro -------
$ pacman -Syu lsb-release
 
------- On RHEL/CentOS -------
$ sudo yum update
$ sudo yum install redhat-lsb-core
 
------- On Fedora -------
$ sudo dnf update
$ sudo dnf install redhat-lsb-core
 
------- On SUSE -------
$ sudo zypper update
$ sudo zypper install lsb-core

Get Linux Distribution Information

Once installed, try to run the lsb_release command again.

$ lsb_release -v
Check Linux OS Version
Check Linux OS Version

To get the list of available options you can refer to the man page or "-h" flag.

$ man lsb_release
$ lsb_release -h
lsb_release Help
lsb_release Help

To check the description, about your distribution use the '-d' flag.

$ lsb_release -d
Check Linux OS Description
Check Linux OS Description

To check the version information using the '-r' flag.

$ lsb_release -r

Release: 20.04

Every distribution comes with a code name. For example, Ubuntu 20.04 comes with the name “Focal Fossa”. To get the name use the ‘-c’ flag.

$ lsb_release -c

Codename:    focal

You can get all the information by using the '-a' flag.

$ lsb_release -a
Check Linux OS Information
Check Linux OS Information

If you look at the output so far it is in key-value pair. You can just display the value alone by using the '-s' flag.

$ lsb_release -i

Distributor ID: Ubuntu

$ lsb_release -is

Ubuntu

That’s it for this article. The lsb_release is a simple command to get information about your distribution.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.