Knowing your Linux version helps determine compatibility with software packages and system updates. If you’re wondering how to show Linux version, you’re in the right place. Whether you’re a beginner or a seasoned sysadmin, checking your Linux version is a simple task that can save you from headaches later. This guide covers multiple methods, from graphical interfaces to command-line tricks, so you can always find the info you need.
Why Check Your Linux Version?
Before we jump into the commands, let’s talk about why you need this. Different Linux distributions (like Ubuntu, Fedora, or Debian) have different package managers and kernel versions. A program built for Ubuntu 22.04 might not work on Ubuntu 20.04. Also, security patches depend on your version. Knowing your version helps you troubleshoot issues and plan upgrades.
You might also need to check the kernel version for hardware support. For example, newer kernels have better drivers for Wi-Fi or graphics cards. So, let’s get started with the easiest ways.
How To Show Linux Version Using The Terminal
The terminal is the most reliable way to check your Linux version. It works on almost all distributions. Here are the most common commands.
Using The lsb_release Command
The lsb_release command shows distribution-specific information. It’s pre-installed on many Ubuntu-based systems. If it’s not, you can install it later.
- Open a terminal (Ctrl+Alt+T).
- Type:
lsb_release -a - Press Enter. You’ll see output like:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
The “Description” line shows the full version. The “Release” line shows the number. This is perfect for Ubuntu, Debian, and similar distros.
Checking The /etc/os-release File
Most modern Linux systems include a file called /etc/os-release. It contains standardized info. To view it:
- Run:
cat /etc/os-release - Output example:
PRETTY_NAME="Ubuntu 22.04.3 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.3 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
This file works on Fedora, CentOS, Arch, and many others. It’s a safe bet for most distros.
Using The hostnamectl Command
If you use systemd (which most distros do now), hostnamectl is handy. It shows both the OS and kernel info.
- Type:
hostnamectl - Look for lines like:
Static hostname: my-pc
Icon name: computer-vm
Chassis: vm
Machine ID: abc123...
Boot ID: def456...
Operating System: Ubuntu 22.04.3 LTS
Kernel: Linux 5.15.0-91-generic
Architecture: x86-64
This gives you the OS version and the kernel version in one go. Very efficient.
Checking The Kernel Version
Sometimes you only need the kernel version. Use uname for that.
- Run:
uname -r - Output:
5.15.0-91-generic
The -r flag stands for “release.” For more details, use uname -a which shows all system info.
How To Show Linux Version Using The GUI
Not everyone likes the terminal. If you prefer a graphical interface, most desktop environments have a settings panel.
On Ubuntu (GNOME Desktop)
- Click the “Activities” button (top-left) or press the Super key.
- Type “Settings” and open it.
- Scroll down to “About” in the left sidebar.
- Look under “Device” or “OS” for the version.
You’ll see something like “Ubuntu 22.04.3 LTS” and the kernel version.
On Fedora (GNOME)
Similar steps:
- Open Settings.
- Go to “About.”
- Check “OS Name” and “Version.”
On Linux Mint (Cinnamon)
- Open the Menu.
- Type “System Info” or “About.”
- Look for “Release” or “Version.”
On KDE Plasma
- Open the Application Launcher.
- Search for “About This System.”
- Click on “Operating System” tab.
GUI methods are slower but easier for visual learners. They also show other details like RAM and processor.
How To Show Linux Version On Different Distributions
Each distribution has its own quirks. Here are specific commands for popular distros.
Ubuntu And Debian
lsb_release -acat /etc/os-releasecat /etc/debian_version(shows Debian-specific version)
Fedora And Red Hat
cat /etc/redhat-releaseorcat /etc/fedora-releaserpm -q centos-release(for CentOS)hostnamectl
Arch Linux
cat /etc/arch-release(often empty but confirms Arch)pacman -Q linux(shows kernel package version)cat /etc/os-release
OpenSUSE
cat /etc/SuSE-release(older versions)cat /etc/os-release
Alpine Linux
cat /etc/alpine-release
For less common distros, try cat /etc/*release to see all release files.
How To Show Linux Version Without A Command
What if you can’t use the terminal? Maybe you’re in a recovery mode or a live USB. Some methods still work.
Check The Boot Screen
When you boot your computer, the GRUB menu often shows the kernel version. Look for lines like “Ubuntu, with Linux 5.15.0-91-generic.”
Look At The Login Screen
Some display managers (like GDM) show the OS name and version at the login screen. It’s usually at the bottom or top corner.
Use A Live USB
If you boot from a live USB, the desktop environment often displays the version in the system menu. For example, Ubuntu’s live session shows “Try Ubuntu” with the version number.
How To Show Linux Version Remotely
If you manage servers, you might need to check versions over SSH. The same commands work remotely.
SSH Into The Machine
- Connect:
ssh user@server-ip - Run:
lsb_release -aorcat /etc/os-release
You can also use ssh user@server-ip "cat /etc/os-release" to get the info without an interactive session.
Check Multiple Servers
For a fleet of servers, use a loop:
for server in server1 server2 server3; do
echo "=== $server ==="
ssh user@$server "cat /etc/os-release"
done
This saves time when auditing many machines.
How To Show Linux Version In Scripts
Automation scripts often need to check the OS version. Here’s how to do it programmatically.
Using Bash
You can source the /etc/os-release file:
#!/bin/bash
source /etc/os-release
echo "This is $NAME version $VERSION_ID"
This sets variables like $NAME and $VERSION_ID.
Using Python
import platform
print(platform.linux_distribution()) # Deprecated but works on older systems
print(platform.platform()) # Shows full platform info
For modern systems, parse /etc/os-release:
with open('/etc/os-release') as f:
for line in f:
if line.startswith('PRETTY_NAME'):
print(line.split('=')[1].strip().strip('"'))
Using Ansible
In Ansible playbooks, use the ansible_facts:
- name: Show OS version
debug:
var: ansible_facts['os_family']
# Also: ansible_facts['distribution_version']
This is great for configuration management.
Common Issues When Checking Linux Version
Sometimes commands don’t work. Here are fixes.
Command Not Found
If lsb_release is missing, install it:
- Ubuntu/Debian:
sudo apt install lsb-release - Fedora:
sudo dnf install redhat-lsb-core - Arch:
sudo pacman -S lsb-release
Empty Output
Some minimal installations don’t include release files. Try uname -a to at least get the kernel. Or check /etc/issue which often has a short description.
Container Environments
In Docker containers, the OS version might reflect the base image. Use cat /etc/os-release inside the container. For Alpine-based containers, use cat /etc/alpine-release.
How To Show Linux Version With One-Liner Commands
For quick checks, here are compact commands.
cat /etc/os-release | grep PRETTY_NAMElsb_release -d(shows only description)hostnamectl | grep "Operating System"uname -r && cat /etc/*release | head -1
These are great for copy-pasting into scripts or quick checks.
Understanding The Output
Let’s decode what you see.
Distribution Version
This is the release number, like “22.04” for Ubuntu. It includes LTS (Long Term Support) or non-LTS. LTS versions get updates for 5-10 years.
Kernel Version
The kernel version looks like “5.15.0-91-generic.” The first number (5) is the major version, second (15) is minor, third (0) is patch. The “-91” is the Ubuntu-specific build number. “generic” means it’s the standard kernel.
Codename
Distros have codenames like “Jammy Jellyfish” or “Focal Fossa.” These help identify the release cycle.
Why Version Matters For Software
When you download a .deb or .rpm package, it’s built for a specific version. Installing a package meant for Ubuntu 23.04 on Ubuntu 22.04 might break dependencies. Always check the version first.
For example, Docker has different installation steps for Ubuntu 20.04 vs 22.04. Python packages might require a certain glibc version. Knowing your version prevents errors.
How To Show Linux Version On Older Systems
Old distros might not have /etc/os-release. Try these alternatives:
cat /etc/issue(often shows “Ubuntu 14.04.5 LTS”)cat /etc/redhat-release(for RHEL/CentOS 6)cat /etc/SuSE-release(for old openSUSE)cat /etc/debian_version(for Debian 7 or older)
If all else fails, uname -a gives the kernel, which hints at the era.
How To Show Linux Version On Embedded Systems
Raspberry Pi, routers, and IoT devices run Linux too. They often use BusyBox, which has limited commands.
- Try:
cat /proc/version(shows kernel version) - Check:
cat /etc/os-releaseif it exists - Use:
uname -a
Some embedded systems don’t have a full distribution, so the kernel version is all you get.
How To Show Linux Version In A File
You might want to save the version for documentation.
- Run:
lsb_release -a > version.txt - Or:
cat /etc/os-release > version.txt
This creates a text file you can share or archive.
How To Show Linux Version For Troubleshooting
When asking for help online, always include your version. It helps others give accurate advice. For example, “I’m on Ubuntu 22.04” is more useful than “I’m on Linux.”
Also, check if your version is still supported. Ubuntu 18.04 reached end-of-life in 2023. If you’re on it, upgrade to avoid security risks.
How To Show Linux Version Using /proc
The /proc filesystem has system info.
cat /proc/versionshows kernel version and compiler info.cat /proc/sys/kernel/ostypeshows “Linux.”cat /proc/sys/kernel/osreleaseshows kernel release.
These work even on minimal systems.
How To Show Linux Version With neofetch
If you want a fancy display, install neofetch. It shows the logo, version, and other system info.
- Install:
sudo apt install neofetch(or your package manager) - Run:
neofetch
Output includes the distribution, kernel, uptime, and more. It’s great for screenshots.
How To Show Linux Version With screenfetch
Similar to neofetch, screenfetch is lighter.
- Install:
sudo apt install screenfetch - Run:
screenfetch
Both tools are optional but fun.
How To Show Linux Version In A Docker Container
Inside a container, the OS version is the base image’s version.
- Enter the container:
docker exec -it container_name bash - Run:
cat /etc/os-release