糖尿病康复,内容丰富有趣,生活中的好帮手!
糖尿病康复 > 检查 ubuntu 版本_如何检查Ubuntu版本–快速简便的方法

检查 ubuntu 版本_如何检查Ubuntu版本–快速简便的方法

时间:2023-07-09 18:53:11

相关推荐

检查 ubuntu 版本_如何检查Ubuntu版本–快速简便的方法

检查 ubuntu 版本

In this tutorial, we will go over the easiest methods to check Ubuntu version from the terminal. You can use any of the methods below depending on what you need. The outputs that the commands provide are very basic, butat the end of the tutorial, we’ve shown some APT packages that give the version information, in a really beautiful ASCII format.

在本教程中,我们将介绍从终端检查Ubuntu版本的最简单方法。 您可以根据需要使用以下任何方法。 这些命令提供的输出是非常基本的,但是在本教程的最后,我们展示了一些APT软件包,它们以非常漂亮的ASCII格式提供了版本信息。

包含Ubuntu版本详细信息的文件 (Files That Contain Ubuntu Version Details)

There are a few configuration files that contain details of the version and the release information of the Linux distribution you’re on. So, if you’re looking for files that can provide you with the required details, keep reading.

有一些配置文件,其中包含版本详细信息以及您所使用的Linux发行版的发行信息。 因此,如果您正在寻找可以为您提供所需详细信息的文件,请继续阅读。

1. LSB发布文件 (1. LSB-Release File)

LSB stands for Linux Standard Base. Thelsb-release fileis located in/etc/lsb-releasedirectory. We can run thecat commandto output the contents of this file.

LSB代表Linux Standard Base。lsb-release文件位于/ etc / lsb-release目录中。 我们可以运行cat命令来输出该文件的内容。

root@ubuntu:~# cat /etc/lsb-releaseDISTRIB_ID=UbuntuDISTRIB_RELEASE=18.04DISTRIB_CODENAME=bionicDISTRIB_DESCRIPTION="Ubuntu 18.04.3 LTS"

LSB Release File to Fetch Ubuntu Version
LSB发布文件以获取Ubuntu版本

2. Ubuntu中的发行文件 (2. Issue File in Ubuntu)

The/etc/issuefile contains information that you see right before a terminal prompt is displayed after logging in.

/ etc / issue文件包含您登录后立即显示终端提示之前看到的信息。

This file is editable by users to allow the display of a custom message before the login prompt is displayed. But if you’re sure there have been no manual changes to the file, it will contain the version of the distribution.

用户可以编辑此文件,以允许在显示登录提示之前显示自定义消息。 但是,如果您确定没有对该文件进行任何手动更改,它将包含该发行版的版本。

root@ubuntu:~# cat /etc/issueUbuntu 18.04.3 LTS \n \l

Etc Issue File
等问题文件

3.操作系统发行文件 (3. OS-Release File)

Another file that offers detailed information about Ubuntu versions is the OS-Release file.

提供有关Ubuntu版本的详细信息的另一个文件是OS-Release文件。

root@ubuntu:~# cat /etc/os-releaseNAME="Ubuntu"VERSION="18.04.3 LTS (Bionic Beaver)"ID=ubuntuID_LIKE=debianPRETTY_NAME="Ubuntu 18.04.3 LTS"VERSION_ID="18.04"HOME_URL="/"SUPPORT_URL="/"BUG_REPORT_URL="/ubuntu/"PRIVACY_POLICY_URL="/legal/terms-and-policies/privacy-policy"VERSION_CODENAME=bionicUBUNTU_CODENAME=bionic

Os Release File
操作系统发行文件

检查您的Ubuntu版本的命令 (Commands To Check Your Ubuntu Version)

Let’s look at the commands that will allow us to check the Ubuntu version from the terminal.

让我们看一下将使我们能够从终端检查Ubuntu版本的命令。

1. lsb_release (1. lsb_release)

This command gives a prettier output of what’s inside the /etc/lsb-release file.

该命令可以更好地输出/ etc / lsb-release文件中的内容。

root@ubuntu:~# lsb_release -aNo LSB modules are available.Distributor ID: UbuntuDescription: Ubuntu 18.04.3 LTSRelease: 18.04Codename: bionic

root@ubuntu:~# lsb_release -dDescription: Ubuntu 18.04.3 LTS

LSB Release Command
LSB释放命令

2. hostnamectl (2. hostnamectl )

Another useful command is the hostnamectl command that will allow you to view very detailed information about the system you’re working on.

另一个有用的命令是hostnamectl命令,它使您可以查看有关正在使用的系统的非常详细的信息。

root@ubuntu:~# hostnamectlStatic hostname: ubuntuIcon name: computer-vmChassis: vmMachine ID: 34ba2d5d0e424b348659116920aacb35Boot ID: ea6f791cea804300ae24faf4992dea44Virtualization: kvmOperating System: Ubuntu 18.04.3 LTSKernel: Linux 4.15.0-74-genericArchitecture: x86-64

hostnamectl Command
hostnamectl命令

检查Ubuntu版本的输出是否正确 (Check Ubuntu Version With Pretty Outputs)

There are many utilities that will satisfy the nerd within you. For a simple task such as finding the version of your Linux distribution, developers spent the time to build (well-known ones) utilities that will print a pretty output with the required OS information.

有许多实用程序可以满足您的内心需求。 对于查找诸如Linux发行版的版本之类的简单任务,开发人员花费时间来构建(众所周知的)实用程序,这些实用程序将打印出包含所需OS信息的漂亮输出。

These are packages that you need to install using theapt installcommand before they become available.

这些是在使用之前必须使用apt install命令安装的软件包。

1.屏幕抓取 (1. screenfetch)

The first command is the screenfetch command. Below is an example of what the default output looks like.

第一个命令是screenfetch命令。 下面是默认输出的示例。

root@ubuntu:~# screenfetch

Screenfetch Output
屏幕抓取输出

This sure is pretty! But this is just the default. Enter the command with the–helpoption and you’ll see how customizable everything in this output is.

这肯定很漂亮! 但这只是默认设置。 输入带有–help选项的命令,您将看到此输出中所有内容的可定制性。

2. Neofetch (2. neofetch)

Similar to screenfetch, neofetch offers a really pretty ASCII character design output with completely customizable characters and colors.

类似于screenfetch,neofetch提供了一个非常漂亮的ASCII字符设计输出,具有完全可自定义的字符和颜色。

root@ubuntu:~# neofetch

Neofetch Output
Neofetch输出

Ubuntu基于哪个版本的Debian? (What Version Of Debian Is Ubuntu Based On?)

You know that Ubuntu is built with Debian as a base. To know which version of Debian your Ubuntu is built on, there’s a Debian_version file in the /etc/ folder.

您知道Ubuntu是以Debian为基础构建的。 要知道您的Ubuntu是基于哪个版本的Debian,在/ etc /文件夹中有一个Debian_version文件。

root@ubuntu:~# cat /etc/debian_versionbuster/sid

Debian Version File Ubuntu
Debian版本文件Ubuntu

结论 (Conclusion)

Now you know how to check the version of your distribution along with two utilities that will allow you to prettify your outputs. We hope this tutorial has been useful to you.

现在,您知道了如何检查发行版的版本以及两个实用程序,这些实用程序可让您美化输出。 我们希望本教程对您有所帮助。

翻译自: /33741/check-ubuntu-version

检查 ubuntu 版本

如果觉得《检查 ubuntu 版本_如何检查Ubuntu版本–快速简便的方法》对你有帮助,请点赞、收藏,并留下你的观点哦!

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。