How to Check Your Ubuntu Version via Command Line

The Dependency Identification Vector

When installing complex software stacks, databases, or containerization platforms (like Docker) on an Ubuntu Linux server, the installation packages are almost always highly specific to the exact version of the operating system you are running. Attempting to install software compiled for Ubuntu 22.04 LTS onto a server running Ubuntu 20.04 LTS will result in catastrophic dependency failures and a broken system. You must definitively identify your operating system version before executing any major installations.

How to Check Your Ubuntu Version

Because headless servers lack graphical “About” menus, you must query the operating system’s internal release files using the command line.

1. Open your terminal application or connect to your server via SSH.
2. The most reliable and universally standard command to query this information is the lsb_release (Linux Standard Base) command. Execute the following, utilizing the -a (all) flag:

lsb_release -a

3. The terminal will immediately output a clean, four-line block of text.
4. The most critical line is the Description: field, which will display the full, human-readable name of your operating system (e.g., Ubuntu 22.04.3 LTS).
5. The Release: field provides the strict numerical version (e.g., 22.04), which is what you will typically use when searching for compatible software packages.

Alternatively, if your server does not have the LSB utilities installed, you can simply command the terminal to output the contents of the core OS release file by typing cat /etc/os-release, which will provide similar diagnostic information.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.