How can I find the version of the Fedora I use?

sudo find /etc | xargs grep -i fedora > searchFedora

gives:

/etc/netplug.d/netplug: # At least on Fedora Core 1
...

But see the Fedora version in the /etc/netplug.d/netplug file. Is it serious?

285366 次浏览
cat /etc/issue

或者像@Bruce ONeel 建议的 cat /etc/fedora-release

uname -a呢?

你也可以试试 /etc/redhat-release/etc/fedora-release:

cat /etc/fedora-release
Fedora release 7 (Moonshine)

你可以试试

lsb_release -a

它至少可以在 Debian 和 Ubuntu 上运行(而且因为它是 LSB,所以它肯定至少可以在其他主流发行版上运行)。http://rpmfind.net/linux/RPM/sourceforge/l/ls/lsb/lsb_release-1.0-1.i386.html显示它已经存在很久了。

Uname-a 与我的 fc11工程

[Belmiro@HP-550 ~]$ uname -a


Linux HP-550 2.6.30.10-105.2.23.fc11.x86_64 #1 SMP Thu Feb 11 07:06:34 UTC 2010
x86_64 x86_64 x86_64 GNU/Linux




[Belmiro@HP-550 ~]$ lsb_release -a


LSB Version: :core-3.1-amd64:core-3.1-noarch:core-3.2-amd64:core-3.2-noarch:deskt
op-3.1-amd64:desktop-3.1-noarch:desktop-3.2-amd64:desktop-3.2-noarch
Distributor ID: Fedora
Description: Fedora release 11 (Leonidas)
Release: 11
Codename: Leonidas
[Belmiro@HP-550 ~]$

建议的标准文件是 /etc/os-release。参见 http://www.freedesktop.org/software/systemd/man/os-release.html

您可以执行以下操作:

$ source /etc/os-release
$ echo $ID
fedora
$ echo $VERSION_ID
17
$ echo $VERSION
17 (Beefy Miracle)

最简单的命令是:

hostnamectl

在我安装 Fedora 25(工作站)时,所有的分发 ID 信息都在这个文件中:

/usr/lib/os.release.d/os-release-workstation

包括,

  • 名称 = 软呢帽
  • VERSION = “25(工作站版)”
  • ID = 软呢帽
  • VERSION _ ID = 25
  • PRETTY _ NAME = “ Fedora 25(工作站版)”
  • < ... >
  • VARIANT = “工作站版”
  • VARIANT _ ID = 工作站

这些命令为第10条工作:

  • Cat/etc/fedora-release
  • Cat/etc/问题
  • Hostnamectl

而其他人没有:

  • Lsb _ release-a
  • 无名氏
cat /etc/*release

对于几乎所有的主要发行来说,它都是通用的。

使用命令,截屏 输出格式信息。

您可以简单地运行这个命令来获取版本号:

rpm -E %fedora

产出:

enter image description here