How to Check Ubuntu Version through Command Line

check ubuntu version from command line

Ubuntu is a popular Linux-based operating system (OS) developed and maintained by Canonical Ltd. It’s an open-source platform, meaning its source code is freely available for anyone to study, modify, and distribute. Ubuntu is known for its ease of use, reliability, and strong community support.

One of Ubuntu’s key features is its regular release (Long Term Support) schedule, with new versions typically coming out every two years. Each release is supported with updates and security patches for a designated period, ensuring users have access to the latest features and fixes.

In this educational write-up I am going to show you the methods to check the Ubuntu version using a command line also called terminal.

Note: I have performed the procedure and commands on Ubuntu 24.04 LTS.

Checking Ubuntu Version through Command Line

There are several methods you can utilize to check your Ubuntu version. For that, launch the terminal either through a shortcut (CTRL + ALT + T) or from the Show Apps.

Method 1: Using hostnamectl command

This is one of the simplest commands for checking the Ubuntu version along with other information like hostname, kernel version, architecture type, etc. Although, this command is used for changing the hostname of your machine but this can also be helpful in checking the ubuntu version.

Execute the following command on the terminal.

hostnamectl 

The output when returned should reveal the Ubuntu version information.

Method 2: Using lsb_release command

This is the second method which is helpful in checking the Ubuntu version.

Run the following command.

lsb_release -a

If you are interested in getting more accurate information about your Ubuntu version, use the -d switch.

lsb_release -d

Method 3: Using /etc/lsb-release command

You can check the Ubuntu version by reading the content of /etc/lsb-release file on the terminal using cat command. The complete command should be written as follows.

cat /etc/lsb-release

Method 4: Using /etc/issue command

Finally, It is also possible to check the Ubuntu version by reading the content of /etc/issue file. You can read the content by using cat command.

cat /etc/issue

Conclusion

We have shown you four methods that can help you in checking the Ubuntu version. First method is hostnamectl command, second method is lsb_release -a command, third and four method is actually checking the content of files /etc/lsb-release and /etc/issue respectively.

Don’t forget to subscribe and keep visiting Linux World.