Accurate knowledge of the Linux distribution name and version keeps documentation, packages, and support resources aligned with the running system. Package repositories, security advisories, and vendor lifecycles are tied to specific releases, so misidentifying a system can result in incompatible instructions or failed upgrades.
On most systems, distribution metadata is exposed through text files under /etc and helper utilities such as lsb_release and hostnamectl. These sources provide fields like NAME, VERSION, PRETTY_NAME, and ID_LIKE, backed by files including /etc/os-release, /etc/lsb-release, and distribution-specific /etc/<distribution>-release and /etc/system-release.
Tool availability varies between distribution families and minimal installations, so relying on a single command can fail on stripped-down images or containers. Combining several methods, and including kernel and architecture information from uname, yields a complete view of the running environment without depending on one particular package.
Steps to check Linux distribution name and version:
- Open the terminal.
- Use lsb_release to check the distribution details.
$ lsb_release -a Distributor ID: Ubuntu Description: Ubuntu 24.04.1 LTS Release: 24.04 Codename: noble
Install lsb-release package if the command is missing or prints the No LSB modules are available warning.
$ sudo apt install lsb-release
- View additional details about the Linux distribution by examining the contents of the /etc/os-release file.
$ cat /etc/os-release PRETTY_NAME="Ubuntu 24.04.1 LTS" NAME="Ubuntu" VERSION_ID="24.04" VERSION="24.04.1 LTS (Noble Numbat)" VERSION_CODENAME=noble ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=noble LOGO=ubuntu-logo
- Examine the contents of the /etc/lsb-release file.
$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=24.04 DISTRIB_CODENAME=noble DISTRIB_DESCRIPTION="Ubuntu 24.04.1 LTS"
- Check the /etc/issue file for basic information.
$ cat /etc/issue Ubuntu 24.04.1 LTS \n \l
- Retrieve OS and distribution information using the hostnamectl command.
$ hostnamectl Static hostname: host Icon name: computer-vm Chassis: vm Virtualization: vmware Operating System: Ubuntu 24.04.1 LTS Kernel: Linux 6.8.0-48-generic Architecture: x86-64Other distributions may expose release data in files such as /etc/system-release or /etc/<distribution>-release; use the available files on the system you are checking.
- Use the uname command to see kernel version and architecture.
$ uname -a Linux host 6.8.0-48-generic #48-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep 27 14:04:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
Kernel and architecture details can be matched with release notes or documentation to refine identification.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.
