Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Using the command line to detect the Ubuntu version method

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Method 1: use the lsb_release utility

The lsb_release utility can display LSB (Linux Standard Library) information about Linux distributions. It is the preferred way to check the Ubuntu version, regardless of which desktop environment or Ubuntu version you are running.

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 on the Description line.

Output:

No LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 18.04 LTSRelease: 18.04Codename: bionic

You can see from the output above that I am using Ubuntu 18.04LTS.

You can also display only the Description line, simply by executing 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 contents of the / etc/issue file that contain the system identification text

The following command needs to be executed:

Cat / etc/issue

Output result:

Ubuntu 18.04 LTS\ n\ l

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

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

Note: this method is effective only if you have Ubuntu 16.04 or later.

The following command needs to be executed:

Cat / etc/os-release

Output:

NAME= "Ubuntu" VERSION= "18.04 LTS (Bionic Beaver)" ID=ubuntuID_LIKE=debianPRETTY_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=bionicUBUNTU_CODENAME=bionic

Method 3: use the hostnamectl command

Hostnamectl is a command that allows the user to set the hostname, but you can also use it to check the Ubuntu version.

Note: this command applies only to Ubuntu 16.04 or later.

The following command needs 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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report