Unlike Windows or macOS, Linux comes in hundreds of different versions, known as distributions (or “distros”). Ubuntu, Fedora, Debian, Linux Mint, and Arch are all Linux, but they use different package managers, configurations, and release cycles.
If you take over administration of a remote server or start working on an unfamiliar machine, you must know exactly which distribution you are using before you can safely install software or modify system settings.
In this guide, you will learn how to view your Linux distribution name and version using the os-release file.
How to Read the os-release File
The most universally reliable way to check your OS version on modern Linux systems (anything using systemd) is to view the contents of the /etc/os-release file. This file contains standardized identification data about the operating system.
- Open your Linux terminal.
- Type the following command using the
catutility to read the file:cat /etc/os-release - Press Enter.
The terminal will print a block of text containing several variables. A typical output will look something like this:
PRETTY_NAME="Ubuntu 22.04.2 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.2 LTS (Jammy Jellyfish)"
ID=ubuntu
ID_LIKE=debian
Understanding the Output
Here is what the most important fields mean:
- PRETTY_NAME: The human-readable name of the distribution, including the version number and release type (e.g., LTS for Long Term Support). This is usually the only line you need.
- NAME: The short name of the OS.
- VERSION_ID: The specific numerical version.
- ID_LIKE: This is highly useful. It tells you the parent distribution. If you are using Linux Mint, the
ID_LIKEfield will sayubuntu, telling you that you can use Ubuntu tutorials and APT commands to manage the system.