Home Wiki > SDB:Find openSUSE version
Sign up | Login

SDB:Find openSUSE version

tagline: From openSUSE

This article describes steps to find which version of openSUSE are you running

The GUI way

Open /etc/os-release in your favorite text editor.


The CLI way

Open a terminal, run

cat /etc/os-release

Both ways should show something similar to:

NAME="openSUSE Leap"
VERSION="42.3"
ID=opensuse
ID_LIKE="suse"
VERSION_ID="42.3"
PRETTY_NAME="openSUSE Leap 42.3"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:leap:42.3"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"

More examples what this file looks like on the various openSUSE and SUSE Linux distributions can be found on SDB:SUSE_and_openSUSE_Products_Version_Outputs.


In Shell Scripts

It's easiest to simply source the file and check the variables it sets, for example

. /etc/os-release
if test "$ID" = "opensuse"
then
    ...
elseif test "$ID" = "arch"
then
    ...

The file /etc/os-release is designed to source quickly. Starting grep or sed to extract information manually will usually be slower. However, if you prefer not to source the file, e.g. for POSIX compliance, potentially conflicting names or control over what happens, here is some code to extract the distribution ID:

osrel=$(sed -n '/^ID=/s/^.*=//p' /etc/os-release);

if test "$osrel" = "opensuse"
then
    ...
elseif test "$osrel" = "arch"
then
    ...

32 vs 64 Bit

The pretty name used to include whether the distribution is 32 or 64 bit with i586 or x86-64 in brackets. Newer versions do not include this information here, also as they usually only come in 64 bit anyway. Stackoverflow suggests to use uname -m or getconf LONG_BIT. The former states the hardware capability, the latter what is running, i.e. for a 32-bit Linux running on a platform that can run both 32 and 64 bit uname -m will say x86_64 and getconf LONG_BIT outputs 32.