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

5
  • 6
    Should be migrated to unix.stackexchange.com Apr 22, 2013 at 11:07
  • 2
    @Fuser97381: That is not true. Curatorship is important and curating does not take place through Google. Jun 23, 2016 at 17:08
  • 1
    @LightnessRacesinOrbit False. Curation (not curatorship, wtf) might be important for the owners of the sites who are making a living off the labour of content creators, but users find information through google, which indexes both sites, so it doesn't matter to them. Jun 25, 2016 at 12:50
  • @Fuser97381: I know it doesn't matter to them, but you insinuated that it does not matter at all, which is false. Jun 27, 2016 at 10:10
  • 1
    cat /etc/fedora-release/
    – Seraf
    Dec 20, 2017 at 16:36

14 Answers 14

189
cat /etc/issue

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

6
  • 11
    However, this won't work if anyone's changed the login banners … I typically edit mine, and so, it seems, do many (most) corporate IT departments... :-(
    – BRPocock
    Dec 2, 2011 at 16:05
  • 8
    That's a wrong answer. The answer of @BruceONeel should be accepted as the correct one May 7, 2017 at 15:33
  • 6
    Doesn't work in fedora 26. However Bruce's answer works. Sep 29, 2017 at 16:29
  • 14
    \S Kernel \r on an \m (\l)
    – MariuszS
    Nov 9, 2017 at 8:16
  • 1
    /etc/fedora-release seems to be the good one, unless I have Fedora version "\S Kernel \r on an \m (\l)" LOL
    – runlevel0
    Nov 21, 2019 at 14:03
157

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

cat /etc/fedora-release 
Fedora release 7 (Moonshine)
1
  • 17
    cat /etc/redhat-release works for me too, but the better is cat /etc/os-release which really gives detailled information. Sep 4, 2015 at 12:02
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)
1
  • 3
    I never thought of using source to load the variables, I always tried to parse the values. Brilliant!
    – wisbucky
    Aug 13, 2018 at 22:22
25

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

hostnamectl
1
  • 1
    This is definitely the most convenient answer and also shows the bitness. Nice! Aug 24, 2018 at 22:06
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.

2
  • 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 2, 2011 at 16:03
  • 1
    Or lsb_release -d for a shorter output. Dec 12, 2016 at 21:02
15
cat /etc/*release

It's universal for almost any major distribution.

1
  • 2
    This is very true! This command can be used on practically any Linux distro. Nov 26, 2017 at 9:03
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
6

What about uname -a ?

4
  • 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. :) Feb 12, 2009 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, 2009 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) Oct 16, 2013 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. Oct 16, 2013 at 17:35
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 ~]$ 
4

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

rpm -E %fedora

output:

enter image description here

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
0

uname -a works with my fc11

0

cat /etc/os-release

Works both on Fedora and Silverblue.

-1

use commmand , screenfetch output format info.

1
  • 1
    Please give a little more details to your solution.
    – Andy A.
    May 18, 2021 at 11:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.