There are different ways to check the Ubuntu version from the command line. Here are some commands you can use:
- cat /etc/os-release
- uname command
- cat /proc/version
- lsb_release command
In this article, I will explain each command in detail and its use cases.
Steps to check Ubuntu version
- Open the terminal
- Type any of the following commands into the command line and press enter.
- cat /etc/os-release
- uname -a
- cat /proc/version
- lsb_release -a
- The terminal shows the Ubuntu version you’re running. It includes the release number, codename, and description.
Check Ubuntu version with cat /etc/os-release command
The cat /etc/os-release command is used to display the name and version of Ubuntu. This will show us a description of the OS along with its version information. You can find the Ubuntu version in the VERSION field.
cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 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"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
From the above example, we can see that the Ubuntu version is 20.04.4 LTS (Focal Fossa).
Check Ubuntu version with uname command
The uname command will display the kernel name and version information of the Ubuntu system. This command is helpful for developers who are interested in the system configuration. $ uname -a
Linux ip-10-0-0-76 5.13.0-1022-aws #24~20.04.1-Ubuntu SMP Thu Apr 7 22:10:15 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Check Ubuntu version with cat /proc/version command
The cat /proc/version command displays more info about the version information. This command will show us the version details for all components of the Ubuntu system such as kernel, compiler, etc.
$ cat /proc/version
Linux version 5.13.0-1022-aws (buildd@ubuntu) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #24~20.04.1-Ubuntu SMP Thu Apr 7 22:10:15 UTC 2022
This is a version string for a Linux operating system with the following format:
Linux version [kernel version] [build information] [#build number]-[distribution name] SMP [date and time of build]
Check Ubuntu version with lsb_release command
The lsb_release is a command in Linux and Unix-based operating systems that is used to display information about the Linux Standard Base (LSB) and the distribution of Linux.
This command will display Ubuntu Description, codename and other related information. The version is under the Description field.
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.4 LTS
Release: 20.04
Codename: focal
By using the commands described above, we should be able to check the Ubuntu version of our system.
I hope this article was helpful. If you have any questions or feedback, please leave a comment below.