If you are attempting to install a specific software package, following a complex tutorial, or asking for help on a Linux forum, the very first question you must answer is: “What version of Ubuntu are you running?”
Because Canonical (the company behind Ubuntu) releases a new standard version every six months, and a Long Term Support (LTS) version every two years, it is incredibly easy to lose track of exactly which release is installed on your machine. Running a command designed for Ubuntu 22.04 on an older Ubuntu 18.04 server can lead to catastrophic dependency errors.
Fortunately, Linux makes it incredibly simple to check your exact operating system version directly from the command line. This guide explains the best commands to find out what version of Ubuntu you are currently running.
Method 1: The LSB Release Command (Recommended)
The lsb_release command is the standard, most reliable way to check your Linux distribution details. “LSB” stands for Linux Standard Base. This command is installed by default on nearly all Ubuntu systems.
Open your terminal and type the following command, then press Enter:
lsb_release -a
The -a flag stands for “all,” instructing the system to print every piece of version information it has. The output will look something like this:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.3 LTS
Release: 22.04
Codename: jammy
The Description line tells you exactly what you need to know, including whether you are on an LTS (Long Term Support) release. The Codename is also highly useful, as many software repositories require you to input the codename (e.g., “jammy” or “focal”) to download the correct packages.
Method 2: Reading the OS Release File
If for some reason the lsb_release command is missing from your system (which is rare, but possible on highly stripped-down Docker containers or minimal server installs), you can simply read the system file where this information is permanently stored.
In the terminal, use the cat command to print the contents of the os-release file located in the /etc/ directory:
cat /etc/os-release
This command outputs a long list of variables used by the system itself. Look for the line that starts with PRETTY_NAME=. It will clearly display your exact version, such as PRETTY_NAME="Ubuntu 22.04.3 LTS".
Method 3: Checking the Kernel Version
Sometimes, knowing the Ubuntu version (like 22.04) is not enough. If you are compiling device drivers from source code or troubleshooting a specific hardware bug, you need to know the exact version of the underlying Linux Kernel that your system is currently utilizing.
To find your kernel version, use the uname (Unix Name) command with the -r (release) flag:
uname -r
The output will be a string of numbers, such as 5.15.0-84-generic. This tells you exactly which kernel architecture is currently managing your hardware, which is vital information when asking for advanced technical support.