Ubuntu is a popular open-source operating system based on the Debian Linux distribution. To ensure compatibility with other software and to receive software updates, it is important to know the version of your Ubuntu system. In this article, we will show you 5 ways to check your Ubuntu version from the command line.
Check Ubuntu Version Using the lsb_release
Command
The lsb_release
command displays information about the Linux Standard Base (LSB) specifications your system complies with, including the distribution name and version. To use this command, open the terminal and enter the following:
lsb_release -a
Output:
Distributor ID: Ubuntu
Description: Ubuntu 20.04 LTS
Release: 20.04
Codename: focal
The output shows that the distribution ID is “Ubuntu,” the description is “Ubuntu 20.04 LTS,” the release is “20.04,” and the codename is “focal.”
Check Ubuntu Version Using the /etc/os-release
File
The /etc/os-release
file contains information about the operating system, including its name and version number. To view this file, open the terminal and enter the following command:
cat /etc/os-release
Output:
NAME="Ubuntu"
VERSION="20.04 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04 LTS"
VERSION_ID="20.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"
The output shows the NAME as “Ubuntu,” the VERSION as “20.04 LTS (Focal Fossa),” the ID as “ubuntu,” and the VERSION_ID as “20.04.”
Check Ubuntu Version Using the /etc/issue
File
The /etc/issue
file contains a message displayed before the login prompt on the system’s console or terminal. This file may also contain information about the operating system, including its version number. To view this file, open the terminal and enter the following command:
cat /etc/issue
Output:
Ubuntu 20.04 LTS \n \l
The output shows the operating system as “Ubuntu 20.04 LTS,” which indicates the version of the operating system.
Check Ubuntu Version Using the /proc/version
File
The /proc/version
file contains information about the Linux kernel, including the operating system name and version. To view this file, open the terminal and enter the following command:
cat /proc/version
Output:
Linux version 5.4.0-62-generic (buildd@lgw01-amd64-045) (gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)) #67-Ubuntu SMP Mon Jan 25 22:20:58 UTC 2022
The output shows the Linux kernel version as “Linux version 5.4.0-62-generic” and the GCC version used to compile the kernel as “gcc version 9.3.0.” This information can be used to determine the version of the operating system, as the Linux kernel version is specific to each release of the operating system.
Check Ubuntu Version Using the hostnamectl
Command
The hostnamectl
command displays information about the system’s hostname, including the operating system and kernel version. To use this command, open the terminal and enter the following:
hostnamectl
Output:
Static hostname: ubuntu
Icon name: computer-laptop
Chassis: laptop
Machine ID: [redacted]
Boot ID: [redacted]
Operating System: Ubuntu 20.04 LTS
Kernel: Linux 5.4.0-62-generic
Architecture: x86-64
The output shows the operating system as “Ubuntu 20.04 LTS” and the kernel version as “Linux 5.4.0-62-generic.” The architecture of the system is also displayed as “x86-64.”
Conclusion:
In this article, we have shown you 5 ways to check your Ubuntu version from the command line. By using one of these methods, you can easily determine the version of your Ubuntu system, which is important for ensuring compatibility with other software and receiving software updates.
Got questions or suggestions on the article? Don’t hesitate to leave a comment below. Your feedback is valuable to us and helps improve the content quality. And don’t forget to share this article with others who might find it useful. Looking forward to hearing from you!
If our tutorials helped you, please consider buying us a coffee. We appreciate your support!
Thank you for your support.