[Fixed] How to Fix "lsb_release command not found" Error in Linux

sohail
sohail

Table of Contents

lsb_release is an important command for bash scriptwriters. It lets the user know about the currently installed Linux distribution, the specific version, and the codename.

Yesterday I was trying to set up a Raspberry pi web server for my client and found out the script I was running to set up certain packages needed to know the distribution name. The script was using lsb_release command to know the distribution’s name but failed with the error “lsb_release command not found”.

I thought the lsb_release command is available in all Linux distributions out of the box, but it is not.

If you get the error “lsb_release command not found“, here is how you can fix it.

Fix for lsb_release command not found

To fix the error, we need to install the lsb-core package. This package is available in almost all repositories. So install lsb-core and it will fix the error.

If your distribution is not Debian-based, it should still be available in the repositories. Use the distro package manager to install lsb-core.

sudo apt install lsb-core

For fedora or derivates –

sudo dnf install lsb-core

For CentOS or derivatives –

sudo yum install lsb-core

For Arch or derivatives –

sudo pacman -S lsb-core
install lsb core
install lsb core

Here is how to use lsb_release command.

lsb_release returns the currently running lsb version. BTW, lsb stands for Linux Standard Base.

lsb_release
lsb_release
lsb_release -a
lsb release a
lsb_release -a
lsb_release -c
lsb release c
lsb_release -c
lsb_release -r
lsb release r
lsb_release -r

You can also combine the arguments to get just the information you need.

lsb_release -rcd
lsb release rcd
lsb_release -rcd

Linux TutorialsUncategorizedhow-to