如何判断正在运行Linux发行版和版本

If you’re using Linux as your desktop operating system, you probably are very aware of what version you are running, but what if you need to connect to somebody’s server and do some work? It’s really useful to know exactly what you are dealing with, and luckily it’s also pretty easy.

如果您使用Linux作为桌面操作系统,那么您可能非常了解所运行的版本,但是如果您需要连接到某人的服务器并执行某些工作,该怎么办? 确切了解您要处理的内容非常有用,幸运的是,这也很容易。

As with everything in Linux there are multiple ways to get things done, so we’re going to show you a few different tricks and you can pick the one that you like the best.

与Linux中的所有内容一样,有多种方法可以完成任务,因此我们将向您展示一些不同的技巧,您可以选择最喜欢的技巧。

如何查看漂亮Linux版本 (How to See the Pretty Linux Version)

The easiest and simplest way to see the Linux distribution name and the version number is also the one that works on almost every type of Linux. Just open up a terminal and type in the following:

查看Linux发行版本名称和版本号的最简单方法也是几乎适用于每种Linux的方法。 只需打开一个终端并输入以下内容:

cat /etc/issue
cat /etc/issue

You’ll be presented with output similar to the screenshot at the beginning of this article, which will look something like this:

在本文开始时,您将获得类似于屏幕截图的输出,如下所示:

Ubuntu 14.04.1 LTS

Ubuntu 14.04.1 LTS

If you need more information you can use a different command, although it may not work on every distro out there, but it definitely works on the major ones. Just like before, open a terminal and type in the following:

如果您需要更多信息,则可以使用其他命令,尽管该命令可能无法在其中的所有发行版上使用,但绝对可以在主要版本上使用。 与之前一样,打开一个终端并输入以下内容:

cat /etc/*release

This will give you something more like this next screenshot, and you can see that not only do you have the release information, but you also get to see the codename and even the URL. What’s actually happening here is that on Ubuntu there is a /etc/os-release file, but on some other versions there might be something like /etc/redhat-release or another name entirely. By using the * in the command we’re just outputting the contents of any of them to the console.

这将为您提供类似于下一个屏幕截图的内容,您不仅可以看到发布信息,还可以看到代号甚至URL。 实际上,这里发生的是在Ubuntu上有一个/ etc / os-release文件,但是在其他一些版本上可能有类似/ etc / redhat-release或其他名称的东西。 通过在命令中使用*,我们只是将其中任何一个的内容输出到控制台。

The easiest method is still the cat /etc/issue command, but this is a nice extra.

最简单的方法仍然是cat / etc / issue命令,但这是一个不错的选择。

如何查看内核版本 (How to See the Kernel Version)

The version of the distribution you are running is actually a completely different thing than the version of the Linux kernel. You can easily see that version number by opening a terminal and typing in the following:

您正在运行的发行版实际上与Linux内核完全不同。 您可以通过打开终端并输入以下内容来轻松查看该版本号:

uname -r
uname -r

This will give you output like the following, in which we can see that we’re using the 3.15.4 kernel version.

这将为您提供如下输出,在其中我们可以看到我们使用的是3.15.4内核版本。

如何判断您是否正在使用64位内核 (How to Tell Whether You Are Using a 64-bit Kernel)

You could probably already tell in the last screenshot that we’re using the 64 bit kernel with the x86_64 text, but the easiest thing to do is use this command from the terminal, which is the same command as before, but with -a for “all” instead of -r for “kernel release.”

您可能已经在上一个屏幕快照中告诉我们,我们正在将64位内核与x86_64文本一起使用,但是最简单的方法是从终端使用此命令,该命令与之前的命令相同,但使用-a表示“全部”而不是-r表示“内核释放”。

uname -a

In this screenshot you can tell that we’re running the x86_64 version of Linux, which means 64-bit. If you were running 32-bit Linux, which you really shouldn’t be doing on a server, it would say “i386” or “i686” instead.

在此屏幕快照中,您可以看出我们正在运行x86_64版本Linux,即64位。 如果您运行的是32位Linux(实际上不应该在服务器上运行),则会显示“ i386”或“ i686”。

The more strict-minded types will probably note that you can use uname -i to show whether you are using 32-bit or 64-bit (useful in a script), but it’s better to just get used to using -a to show you everything at once.

思维更严格的类型可能会指出,您可以使用uname -i来显示使用32位还是64位(在脚本中有用),但是最好习惯于使用-a来显示全部一起。

翻译自: https://www.howtogeek.com/206240/how-to-tell-what-distro-and-version-of-linux-you-are-running/

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值