Is there an authoritative way to get the GNOME version, as long as I have a working GNOME desktop (any version) running? Several of these suggestions don't work on my system, either because the executables and/or packages simply don't exist or the menu item isn't available.
6 Answers
For GNOME 4, they use gnome-shell version. If we look at the source code we can see they are reporting the gnome-shell version as the "GNOME version" in the Settings > Info panel:
static char *
get_gnome_version (GDBusProxy *proxy)
{
g_autoptr(GVariant) variant = NULL;
const char *gnome_version = NULL;
if (!proxy)
return NULL;
variant = g_dbus_proxy_get_cached_property (proxy, "ShellVersion");
if (!variant)
return NULL;
gnome_version = g_variant_get_string (variant, NULL);
if (!gnome_version || *gnome_version == '\0')
return NULL;
return g_strdup (gnome_version);
}
There's a debate right now whether this was the right thing to do, see
info-overview: rename "GNOME Version" to "GNOME Shell Version"
Note the intro to that discussion confirms what I've been saying all the time:
The GNOME version and the GNOME Shell version are not the same thing...
It wouldn't surprise me if they change it again in the future. Until then, to get the Gnome DE version means to get the gnome-shell version so use either
gnome-shell --version
or
busctl --user get-property org.gnome.Shell /org/gnome/Shell org.gnome.Shell ShellVersion
In GNOME 3, version is stored in this file:
/usr/share/gnome/gnome-version.xml
content (on my system):
<?xml version="1.0" encoding="UTF-8"?>
<gnome-version>
<platform>3</platform>
<minor>6</minor>
<micro>2</micro>
<distributor>Arch Linux</distributor>
<date>2012-11-13</date>
</gnome-version>
The file is part of the upstream package called gnome-desktop (note that some distros split it into several packages so on your distro the file may end up in a package with a different name...)
GNOME developers use this file to get the DE version number and display it in System Settings (aka gnome-control-center). So getting GNOME version "the official way" means parsing the said file and extracting platform, minor and micro values.
If you play with that file you can instantly see the results :)

In GNOME 2 the file in question is:
/usr/share/gnome-about/gnome-version.xml
(though this file might be missing on some older Gnome 2 versions IIRC)
Note that for GNOME v.2 & v.3 commands like gnome-session --version, gnome-shell --version, gdm --version etc might return confusing numbers. Those are GNOME desktop components, they are separate packages (with different code, history/changelog and maintainers) and as such their version may be different. They'll report the right GNOME version only if they have the same version as gnome-desktop (which is not always the case).
-
1A friendly update: as of this writing, Debian Stretch (Testing) seems to provide file /usr/share/gnome/gnome-version.xml in package gnome-desktop3-data . To see installation history, on Debian: zgrep " installed" /var/log/dpkg.log* | grep "gnome-desktop3-data" | cut -d':' -f2- | sort -riokevins– iokevins2016-05-30 18:36:05 +00:00Commented May 30, 2016 at 18:36
-
1@iokevins - possible... but I'm not using debian/ubuntu/derivatives and my post isn't distro-specific: upstream, there is only one package and that is
gnome-desktop; some distros may chose to split the package and call the parts whatever. I'll edit my post to be more specific.don_crissti– don_crissti2016-05-30 19:39:07 +00:00Commented May 30, 2016 at 19:39 -
I see it now--appreciate the clarification; thank you!iokevins– iokevins2016-06-02 21:57:15 +00:00Commented Jun 2, 2016 at 21:57
-
here is a
bashexample using xmlstarlet to query the XML in the files to which @don_crissti points.TomRoche– TomRoche2017-02-07 03:44:53 +00:00Commented Feb 7, 2017 at 3:44 -
1Thanks, @don_crissti. Here is a Python 3 script to retrieve the info from that XML: gnome-version.pyLuciano Ramalho– Luciano Ramalho2017-04-30 01:45:35 +00:00Commented Apr 30, 2017 at 1:45
If you launch gnome-system-monitor it shows the version in the dialog:
% gnome-system-monitor
My aging Fedora 14 box

Ubuntu 12.04

-
No
gnome-system-monitoron default Centos 7.5 setup.Axel Bregnsbo– Axel Bregnsbo2020-05-23 09:03:26 +00:00Commented May 23, 2020 at 9:03 -
1No System tab in System Monitor 3.28.2 on RHEL 8.4. Just Processes, Resources, File Systems.Gerold Broser– Gerold Broser2021-08-10 17:51:18 +00:00Commented Aug 10, 2021 at 17:51
Try gnome-session --version. There is a man page for it on my Debian (namely GNOME-SESSION(1)) but the --version option is not listed. Well, for me it says gnome-session 3.4.2.1.
You can run it in the console
DISPLAY=":0" gnome-session --version
(possibly having to change the display).
-
This reports 3.2.1, and
gnome-system-monitorreports 3.4.2, so it doesn't look right. And my distro is fully up to date.l0b0– l0b02013-04-22 05:33:40 +00:00Commented Apr 22, 2013 at 5:33 -
See don_crissti's answer. On my system, /usr/share/gnome/gnome-version.xml has 3.4.2 in it. gnome-session --version reports 3.4.2. gnome-system-monitor reports 3.4.1. based on that and a rough morning I'd say gnome-system-monitor is junk. Further exploring shows that the gnome-system-monitor version (not the gnome version) is 3.4.1.... so that's what that's reporting. Further exploration in my package manager, shows that I have, even with an up-to-date system, a mixture of 3.4.0 (gnome-common), 3.4.1 (gnome-shell) and 3.4.2(gnome-desktop3, gnome-session etc.) components.SuperMagic– SuperMagic2013-04-22 11:47:24 +00:00Commented Apr 22, 2013 at 11:47
-
@SuperMagic: Those numbers are fairly consistent, although it is irritating not to be able to get a definite answer. My
/usr/share/gnome/gnome-version.xmlsays3.4.2, butgnome-session --versionsays3.4.2.1so that's sort of correct (?). Maybe the morale of all of this is that the version isn't holy; it is just a number.Emanuel Berg– Emanuel Berg2013-04-22 22:39:52 +00:00Commented Apr 22, 2013 at 22:39
For very new Gnome systems (>40ish), the file suggested in @don_crissti's answer is not here anymore:
~$ cat /usr/share/gnome/gnome-version.xml
cat: /usr/share/gnome/gnome-version.xml: No such file or directory
I think that the safer way is to follow the official GNOME suggestion:
Which, in my system, gives:
-
2they changed the way they report the gnome version, it's now the same as the shell version. I've updated my post.don_crissti– don_crissti2023-01-08 19:43:52 +00:00Commented Jan 8, 2023 at 19:43
"gnome-shell --version" is showing 3.28.3 in my terminal window.
-
2I want to call your attention to another answer which says "no, you shouldn't use commands like gnome-session --version, gnome-shell --version, gdm --version etc. Those are GNOME desktop components, they are separate packages (with different code, history/changelog and maintainers) and as such their version may be different."2021-07-18 15:50:47 +00:00Commented Jul 18, 2021 at 15:50
-
Thx. I see what you mean, my xml; 3.28.2 and by command: 3.28.3.sjurk– sjurk2021-07-18 16:06:55 +00:00Commented Jul 18, 2021 at 16:06

