如何知道我正在使用哪个 Linux 发行版?

如何知道我正在使用哪个 Linux 发行版?

如何知道我正在使用哪个 Linux 发行版?

uname -a给出

Linux xxxxxx.net 2.6.9-42.0.3.EL.wh1smp #1 SMP Fri Aug 14 15:48:17 MDT 2009 i686 i686 i386 GNU/Linux

我怎么知道这是 Ubuntu/Debian/Fedora 还是 Redhat?

我用它/etc/init.d/serviced restart来重启服务,似乎不是 Redhat 系列的

[itf][~]$ cat /etc/issue
cat: /etc/issue: No such file or directory
[itf][~]$ cat /etc/issue.net
cat: /etc/issue.net: No such file or directory
[itf][~]$ lsb_release -a
-sh: lsb_release: command not found
[itf][~]$ cat /etc/*-release
cat: /etc/*-release: No such file or directory
[itf][~]$ cat /etc/*-version
cat: /etc/*-version: No such file or directory
[itf][~]$ cat /etc/*release
cat: /etc/*release: No such file or directory
[itf][~]$ cat /etc/*_release
cat: /etc/*_release: No such file or directory
[itf][~]$ cat /etc/*version
cat: /etc/*version: No such file or directory
[itf][~]$

答案1

  • 在 Debian 中:/etc/debian_version

  • 在 Ubuntu 中:lsb_release -a or /etc/debian_version

  • 在 Redhat 中:cat /etc/redhat-release

  • 在 Fedora 中:cat /etc/fedora-release

答案2

把事情简单化!

cat /etc/*release

答案3

全部兼容系统将具有/etc/os-release它应该为您提供与分发等相关的信息

NAME=Fedora
VERSION="17 (Beefy Miracle)"
ID=fedora
VERSION_ID=17
PRETTY_NAME="Fedora 17 (Beefy Miracle)"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:fedoraproject:fedora:17"
HOME_URL="https://fedoraproject.org/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"

答案4

尝试http://legroom.net/2010/05/05/generic-method-determine-linux-or-unix-distribution-name

结合查询 LSB 实用程序、发行版信息文件和 uname 中的内核信息的技术组合。它将采用它能找到的最具体的发行版名称,必要时返回通用 Linux。它还将识别 UNIX 变体,例如 Solaris 或 AIX。

相关内容