147
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?

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
pindare
  • 2,382
  • 6
  • 21
  • 24

14 Answers14

187
cat /etc/issue

Or cat /etc/fedora-release as suggested by @Bruce ONeel

vdegenne
  • 12,272
  • 14
  • 80
  • 106
David Grant
  • 13,929
  • 3
  • 57
  • 63
157

You can also try /etc/redhat-release or /etc/fedora-release:

cat /etc/fedora-release 
Fedora release 7 (Moonshine)
Jakuje
  • 24,773
  • 12
  • 69
  • 75
Bruce ONeel
  • 2,069
  • 1
  • 11
  • 3
59

The proposed standard file is /etc/os-release. See http://www.freedesktop.org/software/systemd/man/os-release.html

You can execute something like:

$ source /etc/os-release
$ echo $ID
fedora
$ echo $VERSION_ID
17
$ echo $VERSION
17 (Beefy Miracle)
myroslav
  • 3,703
  • 23
  • 29
  • 3
    I never thought of using `source` to load the variables, I always tried to parse the values. Brilliant! – wisbucky Aug 13 '18 at 22:22
25

The simplest command which can give you what you need but some other good info too is:

hostnamectl
ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
Gorgan Razvan
  • 381
  • 4
  • 11
22

You could try

lsb_release -a

which works on at least Debian and Ubuntu (and since it's LSB, it should surely be on most of the other mainstream distros at least). http://rpmfind.net/linux/RPM/sourceforge/l/ls/lsb/lsb_release-1.0-1.i386.html suggests it's been around quite a while.

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
stephen mulcahy
  • 2,288
  • 1
  • 13
  • 8
  • 1
    It's in package `redhat-lsb`, which wasn't installed by default on my box at work, at least (Fedora 15) (corporate IT fail?) but was on my home Fedora 16 box. (Not sure if it's a default package or not) – BRPocock Dec 02 '11 at 16:03
  • 1
    Or `lsb_release -d` for a shorter output. – ROMANIA_engineer Dec 12 '16 at 21:02
14
cat /etc/*release

It's universal for almost any major distribution.

xgkphdx
  • 141
  • 1
  • 2
7

These commands worked for Artik 10 :

  • cat /etc/fedora-release
  • cat /etc/issue
  • hostnamectl

and these others didn't :

  • lsb_release -a
  • uname -a
Rafael
  • 1,534
  • 1
  • 12
  • 19
6
[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 ~]$ 
cHao
  • 84,970
  • 20
  • 145
  • 172
Belmiro
  • 69
  • 1
  • 1
6

What about uname -a ?

mouviciel
  • 66,855
  • 13
  • 106
  • 140
  • That gives the version of the Linux kernel, which might be from a different version of FC or RHEL. It's debatable if the OS remains that reported by /etc/issue if you change the kernel, but there you are. :) – David Grant Feb 12 '09 at 10:14
  • uname -a does not give the distrib but kernel, network, machine, processor, hardware and GNU/Linux for operating system! That is not enough. – pindare Feb 12 '09 at 12:19
  • uname -a on fedora 19: Linux hostname 3.11.4-201.fc19.x86_64 #1 SMP Thu Oct 10 14:11:18 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux the kernel of fedora has the fedora version embedded in the filename as you can see :) will rerun this command after upgrading to fedora 20 (fedup is running atm, will report back afterwards if the kernel filename changed or not) – Jascha Ehrenreich Oct 16 '13 at 11:38
  • Linux hostname 3.11.4-301.fc20.x86_64 #1 SMP Thu Oct 10 15:09:17 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux thats the output of uname -a after running fedup-cli to update to fedora 20. – Jascha Ehrenreich Oct 16 '13 at 17:35
3

On my installation of Fedora 25 (workstation) all of the distribution ID info was found in this file:

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

This included,

  • NAME=Fedora
  • VERSION="25 (Workstation Edition)"
  • ID=fedora
  • VERSION_ID=25
  • PRETTY_NAME="Fedora 25 (Workstation Edition)"
  • <...>
  • VARIANT="Workstation Edition"
  • VARIANT_ID=workstation
Old Uncle Ho
  • 145
  • 1
  • 5
3

You can simply run this command to get the version number:

rpm -E %fedora

output:

enter image description here

ilia
  • 81
  • 1
0

cat /etc/os-release

Works both on Fedora and Silverblue.

c4rt0
  • 48
  • 6
0

uname -a works with my fc11

-1

use commmand , screenfetch output format info.

prownd
  • 17
  • 4