How to print the Ubuntu version in a terminal?
The following command displays the current Ubuntu version:
lsb_release -a
As an example:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
It is also possible to display the operating system identification data located in the file /etc/os-release.
cat /etc/os-release
Here is an example:
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
The following command displays the current Ubuntu version:
lsb_release -a
As an example:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
It is also possible to display the operating system identification data located in the file /etc/os-release.
cat /etc/os-release
Here is an example:
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
The following command displays the current Ubuntu version:
lsb_release -a
As an example:
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
The following command displays the current Ubuntu version:
lsb_release -a
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 13680 | alphons | https://en.ans.wiki/651/how-to-print-the-ubuntu-version-in-a-terminal | 1 |
| 1 | 12945 | en | https://en.ans.wiki/651/how-to-print-the-ubuntu-version-in-a-terminal | 3 |