Linux version from terminal

How do I find out what version of Linux I’m running?

Is there a way to determine what version (distribution & kernel version, I suppose) of Linux is running (from the command-line), that works on any Linux system?

I’d just like to point out for the record how stupid it is that this is a question which needs asking. This is really quite an indictment on the state of every linux distro.

9 Answers 9

The kernel is universally detected with uname :

$ uname -or 2.6.18-128.el5 GNU/Linux 

There really isn’t a cross-distribution way to determine what distribution and version you’re on. There have been attempts to make this consistent, but ultimately it varies, unfortunately. LSB tools provide this information, but ironically aren’t installed by default everywhere. Example on an Ubuntu 9.04 system with the lsb-release package installed:

$ lsb_release -irc Distributor ID: Ubuntu Release: 9.04 Codename: jaunty 

Otherwise, the closest widely-available method is checking /etc/something-release files. These exist on most of the common platforms, and on their derivatives (i.e., Red Hat and CentOS).

$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=9.04 DISTRIB_CODENAME=jaunty DISTRIB_DESCRIPTION="Ubuntu 9.04" 

But Debian has /etc/debian_version :

$ cat /etc/debian_version 5.0.2 

Fedora, Red Hat and CentOS have:

Fedora: $ cat /etc/fedora-release Fedora release 10 (Cambridge) Red Hat/older CentOS: $ cat /etc/redhat-release CentOS release 5.3 (Final) newer CentOS: $ cat /etc/centos-release CentOS Linux release 7.1.1503 (Core) 
$ cat /etc/gentoo-release Gentoo Base System release 1.12.11.1 

I don’t have a SUSE system available at the moment, but I believe it is /etc/SuSE-release .

Slackware has /etc/slackware-release and/or /etc/slackware-version .

Mandriva has /etc/mandriva-release .

For most of the popular distributions then,

will most often work. Stripped down and barebones «server» installations might not have the ‘release’ package for the distribution installed.

Additionally, two 3rd party programs you can use to automatically get this information are Ohai and Facter.

Note that many distributions have this kind of information in /etc/issue or /etc/motd , but some security policies and best practices indicate that these files should contain access notification banners.

Читайте также:  Linux find all mounts

Источник

Как узнать версию Linux

Когда вы сами устанавливали систему и все настраивали, то точно знаете какой дистрибутив у вас установлен, какая версия и какая версия ядра. Но совсем другая ситуация, когда вы покупаете VPS или пытаетесь настроить компьютер другу или знакомому с Linux. Довольно часто может возникнуть вопрос как узнать версию Linux потому что эта информация часто очень важна. Например, уязвимости в программном обеспечении часто затрагивают только определенные релизы.

В этой небольшой статье мы поговорим о том как посмотреть версию Linux через терминал и какие утилиты для этого используются и в каких конфигурационных файлах можно найти интересующую нас информацию.

Скользящие или фиксированные релизы

Все активные дистрибутивы Linux выпускают новые релизы, только все по-разному. Конечно, дистрибутивы обновляются и между релизами, но пользователям привычен такой порядок, что обновления релиза получают только исправления безопасности и ошибок, а все новые возможности выпускаются новым релизом. Но существуют и другие пути. Сейчас есть два способа выпуска релизов:

Эти способы работают немного по-разному и вам нужно понимать это прежде чем мы перейдем к версии Linux. Скользящие релизы не имеют точек выпуска нового релиза, новые возможности, исправления и улучшения постоянно добавляются в официальный репозиторий и их получают пользователи. Такой подход используется в ArchLinux, Gentoo и OpenSUSE Thumbleweed. Поэтому у таких дистрибутивов нет версий, они всегда имеют самую новую версию после того, как было выполнено обновление пакетов. Но у них есть минус — это более низкая стабильность по сравнению с фиксированными релизами, которые можно хорошо протестировать.

Фиксированные релизы используются в Ubuntu. Каждые 6 месяцев выходит новый релиз, поэтому тут есть четкое разделение на версии, новая версия дистрибутива Linux получает новое программное обеспечение, а затем на протяжении всего термина поддержки получает обновления безопасности.

Как узнать версию Linux?

На самом деле для этого есть очень много методов, начиная от общих признаков и до открыть файл и точно посмотреть версию и имя дистрибутива. Рассмотрим только самые популярные из них.

Узнать дистрибутив

Прежде всего давайте узнаем имя дистрибутива и его версию если это возможно. Для этого будем смотреть содержимое файлов в папке /etc/, которые заканчиваются на release:

В Ubuntu утилита выведет содержимое двух файлов /etc/lsb-release и /etc/os-release. В них будет содержаться исчерпывающая информация о имени дистрибутива и версии его релиза:

Но если мы выполним ту же команду в ArchLinux то получим совсем другой результат:

Тут уже нет версии, есть только имя дистрибутива, поскольку ArchLinux использует систему скользящих релизов. Немного меньше, но почти всю ту же информацию можно получить используя команду lsb_release:

Читайте также:  Vmware esxi vmware tools linux install

Также очень часто вы можете узнать имя дистрибутива посмотрев пункт «О программе» для любого системного приложения или лучше утилиты «Настройки»:

И еще один способ увидеть версию дистрибутива в основанных на Debian системах — посмотреть информацию о сборке пакета:

Узнать версию ядра

Во многих случаях нам нужна не столько версия дистрибутива linux, сколько версия ядра, которое в нем используется. Для просмотра этой информации тоже есть несколько команд:

У меня используется версия ядра 4.8.0-59, тут же мы видим архитектуру системы — x86_64. Обозначение SMB означает, что ядро поддерживает многоядерные процессоры или несколько процессоров. Но мы можем узнать ту же информацию, посмотрев содержимое файла /proc/version:

А еще можно посмотреть строку параметров запуска ядра, она тоже содержит версию:

Есть еще несколько файлов с подобной информацией:

Как узнать архитектуру компьютера

Вы уже знаете как узнать версию Linux, имя дистрибутива и ядро, архитектура уже проскальзывала в командах выше, но существует отдельная команда, которая выводит только архитектуру:

Для этих же целей можно использовать uname:

Выводы

Теперь вы знаете как посмотреть версию Linux. Как видите, в Linux достаточно много способов для решения этой задачи. Надеюсь, эта информация была полезной для вас.

Обнаружили ошибку в тексте? Сообщите мне об этом. Выделите текст с ошибкой и нажмите Ctrl+Enter.

Источник

Linux version from terminal

How to check Debian version: the quick and easy way

How to check Debian version: the quick and easy way

Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.

How to check your Ubuntu version: a guide

How to check your Ubuntu version: a guide

Knowing which Ubuntu version you’re running is helpful for different things. You can use this information to check whether programs are compatible with your system. Or you can include the version number in troubleshooting searches. It’s thus of crucial importance to know how to check your Ubuntu version. Keep reading to find out how to do so in a few simple clicks.

How to delete a Linux directory

How to delete a Linux directory

Sometimes you may need to delete an entire folder rather than just individual files. If you want to remove a Linux directory, there are several ways to do it. Here are a few basic solutions that use either File Manager or Terminal. We also explain what you can do if you don’t have the necessary rights.

How to delete files in Linux

How to delete files in Linux

Deleting files in Linux couldn’t be easier. Whether you use the file manager or work directly in the terminal with the command ‘rm’, you can remove Linux files in just a few clicks. Keep reading to find out how to remove single files, multiple files, files of a certain type, or entire folders.

Читайте также:  Copy file to linux machine

How to use the Linux find command

How to use the Linux find command

While working on a Linux system the command line is frequently used. Many administrative tasks require you to find files and directories based on specific criteria. In doing so, Linux admins are accustomed to using the find command. Here, we’ll show you how the command works and how to use it as a handy tool.

Источник

Linux version from terminal

How to check Debian version: the quick and easy way

How to check Debian version: the quick and easy way

Knowing which Debian version you have not only helps you to choose the right install package for a program – you also need it to get appropriate support in forums. There are several different methods to check your Debian version. In this step-by-step guide, we’ll explain how to check your version using Terminal and Hardinfo.

How to check your Ubuntu version: a guide

How to check your Ubuntu version: a guide

Knowing which Ubuntu version you’re running is helpful for different things. You can use this information to check whether programs are compatible with your system. Or you can include the version number in troubleshooting searches. It’s thus of crucial importance to know how to check your Ubuntu version. Keep reading to find out how to do so in a few simple clicks.

How to delete a Linux directory

How to delete a Linux directory

Sometimes you may need to delete an entire folder rather than just individual files. If you want to remove a Linux directory, there are several ways to do it. Here are a few basic solutions that use either File Manager or Terminal. We also explain what you can do if you don’t have the necessary rights.

How to delete files in Linux

How to delete files in Linux

Deleting files in Linux couldn’t be easier. Whether you use the file manager or work directly in the terminal with the command “rm”, you can remove Linux files in just a few clicks. Keep reading to find out how to remove single files, multiple files, files of a certain type, or entire folders.

How to use the Linux find command

How to use the Linux find command

While working on a Linux system the command line is frequently used. Many administrative tasks require you to find files and directories based on specific criteria. In doing so, Linux admins are accustomed to using the find command. Here, we’ll show you how the command works and how to use it as a handy tool.

Источник

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