有时我需要访问一些运行Linux的服务器(或者像这样的Unix),但是我不知道如何验证服务器上正在使用哪个distribution (有时甚至服务器的“负责人”都不知道)。
有没有一种简单可靠的方法来发现这一点,一种对所有这些都是统一和一致的方法?
发布于 2008-11-05 03:48:50
lsb_release -i
可能会为您工作。
有关更多细节,请访问lsb_release -a
在http://etbe.coker.com.au/2007/08/30/identifying-the-distribution-of-a-linux-system/上的一些讨论
发布于 2008-11-05 03:52:12
cat /etc/*release
大多数发行版都将发布文件放在/etc/
(如/etc/redhat-release
、/etc/gentoo-release
等)中。它通常包含您的发行版的版本号。
发布于 2008-11-05 04:17:05
令人恼火的是,这是一个比看起来更难的问题。
对于Linux系统,使用lsb_release。
$ lsb_release --all
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 8.04.1
Release: 8.04
Codename: hardy
$ lsb_release -i
Distributor ID: Ubuntu
这有一个限制,即lsb_release只适用于Linux版本。
对于所有Unix系统,您还可以解析uname。
$ uname -a
Linux blue-laptop 2.6.24-21-generic #1 SMP Tue Oct 21 23:43:45 UTC 2008 i686 GNU/Linux
您可以在uname Wikipedia page上找到有关系统和发行版的一些信息。
https://stackoverflow.com/questions/264290
复制相似问题