Introduction
Ubuntu is one of the most popular Linux distributions used worldwide. However, when troubleshooting system issues or performing software updates, you may need to check which version of Ubuntu you’re running. This is especially important because certain commands or configurations can vary between versions. In this article, we’ll explain four simple ways to check your Ubuntu version — even if you’re a beginner. Each method has its own advantages, allowing you to choose the best one depending on your situation.
Method 1: Using the lsb_release -a Command
The lsb_release -a command is the most recommended method for checking your Ubuntu version. It provides detailed information about the distribution, including the version number and code name, all in one output — making it useful for both system administrators and regular users.
Steps:
- Open the terminal.
- Enter the following command:
bash lsb_release -a - The output will look like this:
Distributor ID: Ubuntu Description: Ubuntu 20.04.3 LTS Release: 20.04 Codename: focal
Method 2: Checking the /etc/os-release File
The /etc/os-release file contains detailed system information, including the Ubuntu version and distribution name. This method uses the cat command to display the file’s content, allowing you to easily confirm your OS version.
Steps:
- Open the terminal.
- Enter the following command:
bash cat /etc/os-release - The output will appear as follows:
NAME="Ubuntu" VERSION="20.04.3 LTS (Focal Fossa)" ID=ubuntu PRETTY_NAME="Ubuntu 20.04.3 LTS"
Method 3: Checking the /etc/issue File
The /etc/issue file contains the message displayed before the login prompt, and it includes your Ubuntu version. This method is simple and ideal when you just need a quick version check.
Steps:
- Open the terminal.
- Enter the following command:
bash cat /etc/issue - The result will look like this:
Ubuntu 20.04.3 LTS \n \l
Method 4: Using the hostnamectl Command
The hostnamectl command is mainly used to view or change the system’s hostname, but it can also display Ubuntu version details. It’s particularly useful for system administrators who want to see both the hostname and OS version in one command.
Steps:
- Open the terminal.
- Enter the following command:
bash hostnamectl - The output will look like this:
Operating System: Ubuntu 20.04.1 LTS
Comparison Table
| Method | Advantages | Best Use Case |
|---|---|---|
lsb_release -a | Displays all key information at once | General Ubuntu version check |
/etc/os-release | Shows detailed version and support information | When you need in-depth OS release details |
/etc/issue | Simple and quick check | When confirming version during login |
hostnamectl | Displays hostname and version together | Useful for system or server management |
Conclusion
Checking your Ubuntu version is an important step in system administration. Each method has unique advantages, and using the right one helps you manage your system more efficiently. For beginners, the lsb_release -a command is the easiest and most straightforward option. However, knowing other methods allows you to access detailed system information when needed. Make it a habit to check your version regularly to ensure smooth updates and proper support.


