How To Check Ubuntu Version – Quick And Easy Methods

Filed Under: Ubuntu
Check Ubuntu Versions Easy Methods

In this tutorial, we will go over the easiest methods to check Ubuntu version from the terminal. You can use any of the methods below depending on what you need. The outputs that the commands provide are very basic, but at the end of the tutorial, we’ve shown some APT packages that give the version information, in a really beautiful ASCII format.

Files That Contain Ubuntu Version Details

There are a few configuration files that contain details of the version and the release information of the Linux distribution you’re on. So, if you’re looking for files that can provide you with the required details, keep reading.

1. LSB-Release File

LSB stands for Linux Standard Base. The lsb-release file is located in /etc/lsb-release directory. We can run the cat command to output the contents of this file.

root@ubuntu:~# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"
LSB Release File to Fetch Ubuntu Version
LSB Release File to Fetch Ubuntu Version

2. Issue File in Ubuntu

The /etc/issue file contains information that you see right before a terminal prompt is displayed after logging in.

This file is editable by users to allow the display of a custom message before the login prompt is displayed. But if you’re sure there have been no manual changes to the file, it will contain the version of the distribution.

root@ubuntu:~# cat /etc/issue
Ubuntu 18.04.3 LTS \n \l
Check Ubuntu Version Etc Issue File
Etc Issue File

3. OS-Release File

Another file that offers detailed information about Ubuntu versions is the OS-Release file.

root@ubuntu:~# cat /etc/os-release
NAME="Ubuntu"
VERSION="18.04.3 LTS (Bionic Beaver)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.04.3 LTS"
VERSION_ID="18.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=bionic
UBUNTU_CODENAME=bionic
Check Ubuntu Version Os Release File
Os Release File

Commands To Check Your Ubuntu Version

Let’s look at the commands that will allow us to check the Ubuntu version from the terminal.

1. lsb_release

This command gives a prettier output of what’s inside the /etc/lsb-release file.

root@ubuntu:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.04.3 LTS
Release:        18.04
Codename:       bionic
root@ubuntu:~# lsb_release -d
Description:    Ubuntu 18.04.3 LTS
LSB Release Command
LSB Release Command

2. hostnamectl

Another useful command is the hostnamectl command that will allow you to view very detailed information about the system you’re working on.

root@ubuntu:~# hostnamectl
   Static hostname: ubuntu
         Icon name: computer-vm
           Chassis: vm
        Machine ID: 34ba2d5d0e424b348659116920aacb35
           Boot ID: ea6f791cea804300ae24faf4992dea44
    Virtualization: kvm
  Operating System: Ubuntu 18.04.3 LTS
            Kernel: Linux 4.15.0-74-generic
      Architecture: x86-64
Hostnamectl To Check The Version Of Ubuntu
hostnamectl Command

Check Ubuntu Version With Pretty Outputs

There are many utilities that will satisfy the nerd within you. For a simple task such as finding the version of your Linux distribution, developers spent the time to build (well-known ones) utilities that will print a pretty output with the required OS information.

These are packages that you need to install using the apt install command before they become available.

1. screenfetch

The first command is the screenfetch command. Below is an example of what the default output looks like.

root@ubuntu:~# screenfetch
Screenfetch Output
Screenfetch Output

This sure is pretty! But this is just the default. Enter the command with the –help option and you’ll see how customizable everything in this output is.

2. neofetch

Similar to screenfetch, neofetch offers a really pretty ASCII character design output with completely customizable characters and colors.

root@ubuntu:~# neofetch
Neofetch Output
Neofetch Output

What Version Of Debian Is Ubuntu Based On?

You know that Ubuntu is built with Debian as a base. To know which version of Debian your Ubuntu is built on, there’s a Debian_version file in the /etc/ folder.

root@ubuntu:~# cat /etc/debian_version
buster/sid
Debian Version File Ubuntu
Debian Version File Ubuntu

Conclusion

Now you know how to check the version of your distribution along with two utilities that will allow you to prettify your outputs. We hope this tutorial has been useful to you.

Leave a Reply

Your email address will not be published. Required fields are marked *

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages