Skip to content

Find information about distribution and desktop environment

TheAssassin edited this page Dec 28, 2021 · 2 revisions

Please do not hesitate to contribute information about other supported distributions and desktop environments!

Fetching distribution version

Generic solution

On most distributions, this little snippet will return proper version information:

# should work on most Linux distributions
cat /etc/os-release

# alternative version, if the first one does not work
cat /etc/*release

You will find a version number in the output. Example output on Ubuntu:

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

The VERSION and PRETTY_NAME lines each provide a complete version number of your distribution.

The file /etc/os-release is known to be present on the following distributions:

  • Debian and derivatives (Ubuntu, Linux Mint, ...)
  • All variants of openSUSE (Leap, Tumbleweed, ...)
  • Fedora and derivatives
  • CentOS

Fetching desktop environment version

Some desktop environments have an "about" application:

  • XFCE 4: xfce4-about command ("About XFCE" in the application launcher)
  • KDE Plasma 5:
    • kinfocenter (in K menu, navigate to Applications, System, Info Center)
    • plasmashell --version/kf5-config --version (for use in terminal only)

Other desktop environments store the version number in files:

  • GNOME 3: /usr/share/gnome/gnome-version.xml
  • GNOME 2: /usr/share/gnome-about/gnome-version.xml

Also, for some desktop environments, bundled applications support showing the version:

  • GNOME 2: gnome-system-monitor ("System Monitor" in the application launcher)

You can also use your package management, software center etc. to check for the version. For instance, on Debian and derivatives, dpkg -l | grep -i <desktop> (substitute <desktop> with your desktop environment's name, e.g., plasma, xfce, lxqt) will yield some version information.