Use the command line to detect the Ubuntu version method

Method 1: Use the lsb_release utility

The lsb_release utility can display information about the LSB (Linux Standard Library) of the Linux distribution. It is the preferred method to check the Ubuntu version, no matter which desktop environment or Ubuntu version you are running, this method can be used.

Let's take a look at how to detect the Ubuntu version:

1、 Use the Ctrl+Alt+T keyboard shortcut or click the terminal icon to open the terminal.

2、 Use the lsb_release -a command to display the Ubuntu version, and you will see the Ubuntu version information in the Description line

Output:

No LSB modules are available.

Distributor ID: Ubuntu

Description:  Ubuntu 18.04 LTS

Release:18.04

Codename:  bionic

From the above output, you can see that I am using Ubuntu 18.04 LTS.

You can also display only the Description line, just execute the following command:

lsb_release -d

Output:

Description:  Ubuntu 18.04 LTS

Method 2: Use the cat command

1、 Use the cat command to display the content of the /etc/issue file containing the system identification text

The following commands need to be executed:

cat /etc/issue

Output result:

Ubuntu 18.04 LTS \n \l

2、 Use the cat command to display the information in the /etc/os-release file

/etc/os-release is a file containing operating system identification data and can only be found on newer Ubuntu versions running systemd.

Note: This method is only valid if you have Ubuntu 16.04 or higher.

The following commands need to be executed:

cat /etc/os-release

Output:

NAME="Ubuntu"

VERSION="18.04 LTS (Bionic Beaver)"

ID=ubuntu

ID_LIKE=debian

PRETTY_NAME="Ubuntu 18.04 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

Method 3: Use the hostnamectl command

hostnamectl is a command that allows users to set a hostname, but it can also be used to check the Ubuntu version.

Note: This command is only applicable to Ubuntu 16.04 or higher.

The following commands need to be executed:

hostnamectl

Output:

Static hostname: linuxize

  Icon name: computer-vm

  Chassis: vm

 Machine ID: f1ce51f447c84509a86afc3ccf17fa24

  Boot ID: 2b3cd5003e064382a754b1680991040d

 Virtualization: kvm

 Operating System: Ubuntu 18.04 LTS

  Kernel: Linux 4.15.0-22-generic

 Architecture: x86-64

Recommended Posts

Use the command line to detect the Ubuntu version method
Use the command to solve the Ubuntu projector problem:
ubuntu16.04 method steps to upgrade the kernel
How to use dpkg command in Ubuntu system
How to enter python through the command line
Introduction to the use of Hanlp in ubuntu
ubuntu command line search
Use virtualbox to deploy ubuntu
Find the kernel source code corresponding to the running Ubuntu version
Detailed steps to automatically set the line number in ubuntu16.04
Ubuntu Server Chapter 2 Command Line Basics
Ubuntu basic settings: introduction to the installation and use of openssh-server
Install the latest Python 3.6 version on Ubuntu
Use mendeley to insert references under ubuntu
The locate file search command in Ubuntu16.04
Ubuntu18.04 Server version installation and use (graphic)
The apt-get command of Ubuntu basic tutorial
How to use Samba server on Ubuntu 16.04
Ubuntu17.04 configuration method to replace domestic sources
Ubuntu modified the default sh to bash
Python novice learns to use the library
The relationship between Open3D version and Ubuntu
Use python3 to install third on ubuntu
How to modify the hostname on Ubuntu 20.04
windows use ubuntu to start linux service
ubuntu command line search
Ubuntu Server Chapter 2 Command Line Basics
Ubuntu16.04 common command notes
ubuntu set Chinese font
Use the command line to detect the Ubuntu version method
Ubuntu 20.04 Chinese input method support
Centos8-graphical interface and command line switching
ubuntu20.04 Chinese input method installation steps
Python Chinese encoding setting under ubuntu
Ubuntu 19.1 installation and configuration Chinese environment
How to use Prometheus to monitor your Ubuntu 14.04 server
How to use the round function in python
How to configure TensorFlow use environment in Ubuntu
Solution for Ubuntu unable to connect to the network
Summary of methods to use Evernote under Ubuntu 14.04
ubuntu16.0.4 method to set a fixed IP address
How to use the zip function in Python
Install the CPU version of Caffe on Ubuntu
Use rsync to remotely backup data under Ubuntu
Explain the solution to the Ubuntu 16.04 launcher icon exception
How to use Nginx's map module on Ubuntu 16.04
Install the old version of seurat under Ubuntu
How to install and use Docker on Ubuntu 20.04
The solution to the failure to install .deb under Ubuntu 16.04
How to install and use Curl on Ubuntu 18.04
How to install and use Composer on Ubuntu 18.04
How to install and use Wine on Ubuntu 18.04
How to use the format function in python
How to use Docker data volumes on Ubuntu 14.04
How to open the ubuntu system in win10
Use doxygen to generate API documentation under Ubuntu 12.04
How to install and use Composer on Ubuntu 20.04
The road to reinstallation of ubuntu 18.04 from scratch
How to install and use BaasBox on Ubuntu 14.04
Wsl sets the default account to root (ubuntu18.04)
Publish the node.js project under Ubuntu to heroku
How to use Jenkins to build automatically on Ubuntu
The use of crontab for ubuntu scheduled tasks
How to install and use PostgreSQL on Ubuntu 16.04
The ultimate guide to install gooderp on ubuntu
How to run the parsing server on Ubuntu 14.04
Use command to clear specific hostname in CentOS7
The latest method of installing Mongodb on Ubuntu 16.04
How to install Chinese input method on ubuntu
How to check the installed JDK on Ubuntu