The lsb_release -a command displays detailed Linux distribution information, including distributor ID, OS version, release number, and codename. It is commonly used by system administrators, DevOps engineers, and security teams to verify operating system details for compatibility, automation, and compliance purposes.
In Linux system administration, accurately identifying the operating system and distribution details is a fundamental task. Whether you are troubleshooting an issue, validating application compatibility, preparing for compliance audits, or managing heterogeneous environments, knowing the exact Linux distribution and version is critical.
The lsb_release -a command provides a standardized and reliable way to retrieve this information.
Table of Contents
What Is lsb_release?
lsb_release is a command-line utility that displays Linux Standard Base (LSB) information about the currently running Linux distribution. The Linux Standard Base defines a common set of specifications intended to improve compatibility across Linux distributions.
The command reads metadata from system files (such as /etc/os-release or distribution-specific LSB files) and presents it in a consistent, human-readable format.
Syntax of lsb_release -a
lsb_release -a
Explanation of the Option
-a(all): Displays all available LSB information about the Linux distribution.
Sample Output
Distributor ID: Ubuntu
Description: Ubuntu 22.04.5 LTS
Release: 22.04
Codename: jammy
Understanding the Output Fields
Each line of the output provides specific system information:
Distributor ID
Identifies the Linux distribution vendor.
- Examples:
Ubuntu,Debian,RedHatEnterpriseServer,CentOS
Description
A descriptive string including:
- Distribution name
- Version
- Support classification (e.g., LTS)
This is especially useful for documentation and audits.
Release
Indicates the major and minor release version of the OS.
- Example:
22.04
Codename
The internal codename assigned by the distribution.
- Example (Ubuntu):
jammy - Example (Debian):
bookworm
Codenames are often referenced in repositories, package sources, and upgrade documentation.
Why lsb_release -a Is Important
System Administration
- Verify OS versions before applying patches or upgrades
- Confirm compatibility with software packages
- Standardize environment documentation
DevOps and Automation
- Used in shell scripts to conditionally execute logic based on OS version
- Helps CI/CD pipelines adapt to different Linux distributions
Example:
if lsb_release -a | grep -q "Ubuntu 22.04"; then
echo "Running on Ubuntu 22.04"
fi
Security and Compliance
- Validate supported operating systems for PCI DSS, SOC 2, or ISO 27001
- Ensure systems are within vendor-supported lifecycles
- Assist during vulnerability management and audit evidence collection
Common Use Cases
- Checking OS version on cloud servers
- Verifying production vs staging environments
- Troubleshooting package installation issues
- Preparing upgrade or migration plans
- Incident response and forensic analysis
When lsb_release Is Not Installed
On minimal installations, the command may not be available by default.
Error Example
command not found: lsb_release
Install lsb-release
Ubuntu / Debian
sudo apt update
sudo apt install lsb-release
RHEL / CentOS / Rocky Linux
sudo yum install redhat-lsb-core
Alternative Commands
If lsb_release is unavailable, you can use:
cat /etc/os-release
or
hostnamectl
However, lsb_release -a remains the most standardized and script-friendly option across distributions.
Best Practices
- Use
lsb_release -ain automation scripts for consistent OS detection - Capture output as part of system inventory and asset management
- Combine with lifecycle tracking to avoid running unsupported OS versions
- Restrict execution permissions in hardened environments if required
Conclusion
The lsb_release -a command is a simple yet powerful tool for identifying Linux distribution details in a standardized way. From daily system administration to enterprise-scale compliance and automation, it plays a critical role in maintaining clarity, compatibility, and operational confidence across Linux environments.
Understanding and using this command effectively helps ensure your systems remain secure, supported, and well-documented.

One comment on “lsb_release -a Explained: Check Linux OS Version, Release, and Codename”