Suse linux release version

SDB:Определение версии openSUSE

Откройте /etc/os-release в предпочитаемом текстовом редакторе.

Путь командной строки

Откройте терминал и выполните команду

В обоих случаях должно получиться нечто-то похожее:

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/" 

Дополнительные примеры того, как выглядит этот файл в различных дистрибутивах openSUSE и SUSE Linux, можно найти в статье SDB:SUSE_and_openSUSE_Products_Version_Outputs.

Для скриптов оболочки

Проще всего просто подключите файл и проверить переменные которые он задает, например

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

Файл _/etc/os-release_ крайне прост в использовании. Использование grep или sed для этих же целей обычно работает медленнее. Тем не менее, в случае когда включение данного файла в ваш скрипт нежелательно (или невозможно), например, для совместимости с POSIX стандартом, устранения потенциального конфликта имён или для более жёсткого контроля далее приведен код для извлечения идентификатора дистрибутива:

osrel=$(sed -n '/^ID=/s/^.*=//p' /etc/os-release); if test "$osrel" = "opensuse" then . elseif test "$osrel" = "arch" then .

32 и 64 бит

Красивое имя дистрибутива указывающее на его принадлежность к 32- или 64-битной системе включает в себя упоминание в скобках строки i586 или x86-64. Более новые версии не включают эту информацию, так как они имеют поддержку только 64-битных систем. Stackoverflow предлагает использовать _uname -m_ или _getconf LONG_BIT_. Результат первой команды основывается на используемом аппаратном обеспечении, а вторая битность запущенного ПО. То есть для 32-разрядного Linux, работающего на платформе, которая может исполнять как 32, так и 64-разрядные вычислительные операции uname выдаст строку _x86_64_, а getconf — 32.

Примеры

Источник

SDB:Find openSUSE version

The os-release file is the file which contains all openSUSE version details. Please refer to the upstream documentation for details.

  • NAME= The human-friendly name of the distribution, without version number. eg «openSUSE Leap» or «openSUSE Tumbleweed». Automatically parsing this field should be avoided.
  • PRETTY_NAME= The human-friendly name of the distribution, including version number when relevant. eg «openSUSE Leap 15.0» or «openSUSE Tumbleweed». Automatically parsing this field should be avoided.
  • VERSION= The human-friendly version of the distribution. Only used in Leap eg. «15.0». Automatically parsing this field should be avoided.
  • ID= The computer-friendly name of the distribution, without version number. eg «opensuse-leap» or «opensuse-tumbleweed». This field should be safe for parsing in scripts.
  • ID_LIKE= A space separated list of IDs for related operating systems with common behaviour to eg «opensuse suse». This is so scripts don’t need to micro-manage every possible option of The entry of «suse» represents all openSUSE, SUSE, SUSE Linux Enterprise distributions and derivatives. «opensuse» repesents only openSUSE distributions and derivatives. This field should be safe for parsing in scripts.
  • VERSION_ID= The computer-friendly version of the distribution. eg. «15.0» or «20180530». This field should be safe for parsing in scripts.
Читайте также:  Shared memory free linux

/usr/lib/os-release should be used unless /etc/os-release exists, which should be given precedence.

On openSUSE distributions /etc/os-release is normally a symlink to /usr/lib/os-release by default

The GUI way

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

The CLI way

This should show something similar to:

NAME="openSUSE Leap" VERSION="15.0" ID="opensuse-leap" ID_LIKE="suse opensuse" VERSION_ID="15.0" PRETTY_NAME="openSUSE Leap 15.0" ANSI_COLOR="0;32" CPE_NAME="cpe:/o:opensuse:leap:15.0" 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

if [ -e /etc/os-release ]; then . /etc/os-release else . /usr/lib/os-release fi if [ "$ID" = "opensuse-leap" ]; then echo "Do something Leap specific" . elif [ "$ID" = "opensuse-tumbleweed" ]; then echo "Do something Tumbleweed specific" . fi 

However this is not suitable for scripts which need to do things for the broader openSUSE family of distros (ie. Leap, Tumbleweed and variants like Kubic), nor the entire *SUSE family of distros (ie. Leap, Tumbleweed, variants, AND SLE)

For this you need to start using the ID_LIKE field, depending on the scope you are interested in.

if [ -e /etc/os-release ]; then . /etc/os-release else . /usr/lib/os-release fi if [[ "$ID_LIKE" = *"suse"* ]]; then echo "Do something for any SUSE/openSUSE distro" . elif [[ "$ID_LIKE" = *"opensuse"* ]]; then echo "Do something for any openSUSE distro, but not other SUSE distros" . fi 

The os-release file 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' /usr/lib/os-release); if [ "$osrel" = "opensuse-leap" ]; then . fi 

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.

Читайте также:  Port proton linux удалить

Examples

Источник

How to Find openSUSE Linux Version

In this article, we will explain how to find out which version of openSUSE Linux distribution installed and running on a computer. The /etc/os-release and /usr/lib/os-release files include all openSUSE version information and you can view openSUSE Version information in these two files using your favorite text editor from the graphical user interface (GUI) or from the command line interface (CLI) as shown below.

From the GUI, simply open the /etc/os-release and /usr/lib/os-release files using your favorite text editor. For example using Kate text editor, which contain operating system identification data.

Find openSUSE Version in GUI

Alternatively, open the terminal and use the cat utility to view contents of /etc/os-release and /usr/lib/os-release as shown.

$ cat /etc/os-release OR $ cat /usr/lib/os-release file

Find openSUSE Version

Some of the important fields in the file are explained below:

  • NAME: A human-friendly name of the distribution, without the version number. example “openSUSE Leap“.
  • PRETTY_NAME: A human-friendly name of the distribution, with a version number. example “openSUSE Leap 15.0“.
  • VERSION: A human-friendly version of the distribution. example “15.0“.
  • ID: A computer-friendly name of the distribution, without the version number. example “opensuse-leap“. This field should be safe for parsing in scripts.
  • ID_LIKE: A space divided list of IDs for equivalent operating systems with common behavior to ID=. example “opensuse suse“. Note that the entry of “suse” means all openSUSE, SUSE, SUSE Linux Enterprise distributions and derivatives such as “opensuse” represents only openSUSE distributions and derivatives.
  • VERSION_ID: A computer-friendly version of the distribution. example “15.0” or “20180530“.
Читайте также:  Кто создал операционную систему linux

Another Alternative way is to use the lsb_release command to find the version of your currently running OpenSuSE Linux as shown.

Note: Your system must have lsb-release package installed, if not, install it using zypper command as shown.

$ sudo zypper install lsb-release

That’s all! In this short article, we have described instructions on how to find which version of openSUSE you are running via the Graphical and Command-line way. If you have any questions or thoughts to share concerning this topic, reach us via the comment form below.

Источник

Оцените статью
Adblock
detector