2024-05-04
lsb_release?lsb_release is a command-line utility that retrieves information about your Linux distribution based on the LSB (Linux Standard Base) information. The LSB aims to standardize Linux systems, making applications more portable. While not all distributions strictly follow the LSB, many include this command, providing a consistent way to identify the distribution and its version.
The simplest way to use lsb_release is to run it without any arguments:
lsb_release -aThis will output an overview of your system’s distribution details. Let’s break down the typical output:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy
For more granular control, lsb_release offers many options:
-a or --all: (As shown above) Displays all available information.-c or --codename: Shows only the codename.lsb_release -cThis would output only:
Codename: jammy
-d or --description: Shows only the description.lsb_release -dThis would output:
Description: Ubuntu 22.04.2 LTS
-i or --id: Shows only the distributor ID.lsb_release -iThis would output:
Distributor ID: Ubuntu
-r or --release: Shows only the release number.lsb_release -rThis would output:
Release: 22.04
If lsb_release is not found on your system, it’s possible your distribution doesn’t fully support LSB or the package needs to be installed. Check your distribution’s package manager (apt, yum, dnf, pacman, etc.) for the lsb-release package and install it if necessary. For example, on Debian-based systems, you might use:
sudo apt update
sudo apt install lsb-releaseThe specific output might vary slightly depending on the distribution and version, but the core information will remain consistent, providing a reliable way to identify your Linux system’s details. Using these targeted options allows for scripting and automation, making lsb_release a powerful tool for system administration tasks.