Swiftorial Logo
Home
Swift Lessons
Tutorials
Learn More
Career
Resources

Using lsb_release

Introduction

The lsb_release command is a utility used in Unix-like operating systems to display Linux Standard Base (LSB) and distribution-specific information. This information is crucial for system administrators and developers who need to know the exact version and distribution of the operating system they are working with.

Installing lsb_release

Before using the lsb_release command, you may need to install it. On most Linux distributions, you can install it using the package manager.

For Debian-based systems (e.g., Ubuntu):

sudo apt-get install lsb-release

For Red Hat-based systems (e.g., Fedora):

sudo yum install redhat-lsb-core

Basic Usage

The most basic usage of lsb_release is to simply run the command without any options:

lsb_release

LSB Version:    core-4.1-amd64:core-4.1-noarch

Displaying All Information

To display all available information about the distribution, use the -a option:

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.1 LTS
Release:        20.04
Codename:       focal
                    

Displaying Specific Information

You can also use specific options to display particular pieces of information:

  • -d : Description of the distribution
  • -r : Release number of the distribution
  • -c : Codename of the distribution
  • -i : Distributor ID

Example of displaying the description:

lsb_release -d

Description:    Ubuntu 20.04.1 LTS

Example of displaying the release number:

lsb_release -r

Release:    20.04

Combining Options

You can combine multiple options to retrieve specific information in one command:

lsb_release -dc

Description:    Ubuntu 20.04.1 LTS
Codename:       focal
                    

Conclusion

The lsb_release command is a powerful tool for retrieving detailed information about your Linux distribution. Whether you are a system administrator, developer, or just a curious user, knowing how to use this command can be highly beneficial.