Check system version linux

How to Check OS Version in Linux

Linux version can be checked using inbuilt commands or can read from specific files. It is important to determine the distribution name and version on many occasion like when doing package updates or OS update.

There are a lot of Linux distributions available like Debian, Ubuntu, CentOS, Mint, Arch, Fedora, RHEL, and more.

In this tutorial, I will show how to check the Linux version from the command line.

Check Linux Version

There are mainly 5 ways we can get Linux distribution name and its version.

1. From /etc/os-release

Use cat command to read the content of the file /etc/os-release , run the following command:

Output from CentOS

Output from Ubuntu

2. Using lsb_release command

The lsb_release -a displays the Linux version information from the command line. The output will display distribution ID, description, release and codename. To display only the description you can use lsb_release -d .

If you get «command not found» and then you need to install ‘lsb-core’ package.

Output of lsb_release -a

To display only the description, run:

3. Using Hostnamectl command

In modern Linux distributions which use systemd init systems, you can use hostnamectl command to display operating system version.

4. From /etc/issue file

You can get version information from /etc/issue file, to read file content use cat or less command:

5. From /etc/*release or /etc/*version

Some distribution use release and version file and those files are specific to that distro.

$ echo /etc/*version /etc/*release
/etc/debian_version /etc/ec2_version /etc/lsb-release /etc/os-release

To read the content from /etc/*release or /etc/*version, run the following command:

If you are interested to know the Linux kernel version and architecture then use uname command or you can read the content from /proc/version file.

Conclusion

In this tutorial, we learned different ways to find Linux OS name and version from I hope you enjoyed reading and please leave your suggestion in the below comment section.

Источник

How to check os version in Linux command line

Check os version in Linux

The procedure to find os name and version on Linux:

  1. Open the terminal application (bash shell)
  2. For remote server login using the ssh: ssh user@server-name
  3. Type any one of the following command to find os name and version in Linux:
    cat /etc/os-release
    lsb_release -a
    hostnamectl
  4. Type the following command to find Linux kernel version:
    uname -r

Let us see all examples in details for common Linux distros.

The /etc/os-release file

Type the following cat command:
$ cat /etc/os-release
Sample outputs:

We can filter out information such as OS version and name using the grep command/egrep command as follows:
$ grep ‘^VERSION’ /etc/os-release
$ egrep ‘^(VERSION|NAME)=’ /etc/os-release
Here is what we see:

Even tiny Linux distro such as Alpine Linux provide the required OS (Operating system) information, including version:

Checking OS version on Linux using the lsb_release command

The lsb_release command gives LSB (Linux Standard Base) and distribution-specific information on the CLI. The syntax is:
$ lsb_release -a
Sample outputs:

Читайте также:  Mac os перезапустить touch bar

hostnamectl command

Use hostnamectl command to query and change the system hostname and related settings. Just type the following command to check OS name and Linux kernel version:
$ hostnamectl
And it will give info as follows. Look out for “ Operating System ” and “ Kernel “:

Another outputs from my OpenSUSE Linux 15.2 server:

uname command

/etc/issue file

Use more command/less command as follows:
$ cat /etc/issue
$ more /etc/issue
$ less /etc/issue

Getting help

You can also view the manual page on uname using the following command:
$ man hostnamectl
$ man uname
$ man cat

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

Conclusion

We explained how to find and display the OS version on Linux. The safest option is to query /etc/os-release file using grep or cat command. Systemd based Linux distro users can use the hostnamectl command.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

Linux Command: Show Linux Version

[a] uname – Print kernel and system information.

Tutorial details
Difficulty level Easy
Root privileges No
Requirements None
Est. reading time 1m

[b] lsb_release – Print distribution-specific information. [c] /proc/version file – Print running kernel information.

How to check linux kernel version number?

Open a shell prompt (or a terminal) and type the following command to see your current Linux kernel version:
$ uname -r
Sample outputs:

Or type the following command:
$ uname -mrs
Sample outputs:

To print all information, enter:
$ uname -a
Sample outputs:

  • 2.6.32-23 – Linux kernel version number
  • pae – pae kernel type indicate that I’m accssing more than 4GB ram using 32 bit kernel.
  • SMP – Kernel that supports multi core and multiple cpus.

/proc/version file

Type the following command to see Linux version info:
$ cat /proc/version
Sample outputs:

The above output identifies the kernel version that is currently running. It includes the contents of /proc/sys/kernel/ostype , /proc/sys/kernel/osrelease , and /proc/sys/kernel/version files. For example:
$ cat /proc/sys/kernel/
Sample outputs:

Find Distribution Version

Type the following command:
$ cat /etc/*release
OR
$ lsb_release -a
Sample outputs:

Here is another output from my Debian based server:

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

This tutorial is also available in a quick video format:

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Источник

Best 3 Ways To Check Linux OS Version In Command Line

To troubleshoot issues and know about the device’s compatibility, knowing what version of Linux you are using is important. If you are looking for the answer to the simple old “How To Check Linux Version” then you would get the answer right here. Knowing what OS you are running on your computer or smartphone can you a lot in troubleshooting issues. You can determine which software or which applications are compatible with your device too when you know what Operating system your system is running.

In this post you will find about three ways to Check Linux OS Version in your device, you can use either of them to get things working. But before we start with the guide, let us get to know what Linux is and what is its history.

Yes, yes, you all must know what Linux is because you use it yourself. But do you know that you can contribute to Linux if you are good enough?

Table of Contents

What Is Linux?

Best known for being an open source operating system, Linux is the most used OS out there. It sits underneath all the other software on a computer receiving and relaying commands.

An operating system is a software that tells the computer how to function. It has the command over hardware, executer programs, manages all the tasks and resources, and provide the user with an interface to the computer.

In many ways, Linux is similar to other Operating Sytems that you may have encountered such as Windows, iOS, or Mac. Like any other operating system, Linux is a graphical interface and all the software that other Operating Systems have, do have Linux equivalents.

But this operating system is different from others on many important levels. First of them is that Linux is an open source. The code that is used to create Linux is available for free to view, edit, or even contribute to if you have appropriate skills.

A little history about Linux – Linux was created in 1991 by Linus Torvalds, the original author of the code. He built Linux as a free and open source and originally intended to call it “Freax”.

Command To Check Linux Version

The easiest Command To Check Kernel Version In Linux is “uname -a”.

  • Open command prompt
  • Type uname -a

>>>> This will give you your kernel version

Additionally, you can check out what distribution of Linux you are running by typing “lsb_release -a” or “cat /etc/*release” or “cat /etc/issue*” or “cat /proc/version” on the command prompt.

To check if you have a 32-bit or 64-bit OS

  • Open command prompt
  • Type uname -a

>>>> If you see x86_64 or ia64 then your OS is 64-bit

>>>> If you see i386 or i486 or i586 or i686 then your OS is 32-bit

Check Linux Kernel Version

Method #1 Using uname command

uname is the command in Linux to get system information, you can use this command to check whether you are using a 32-bit or 64-bit system.

Here is how to do it –

1. Open a terminal (command prompt) and use the following command –

>>>> You will get an output similar to this –

>>>> What does this output mean?

This output means that the Linux kernel version that you are using is 4.4

Linux Version Command

Method #2 Using /proc/version file

The Linux Kernel information could also be checked by using /proc/version.

  1. Just look at the content of the file:

>>>> You will see an output similar to the method #1

You can see the kernel version 4.4.0-97-generic here.

How To Check OS Version In Linux Command Line

Method #3 Using dmesg command

This command is a powerful one and is used to write the kernel messages. It shows you a lot of information, but since you have to just check the Linux version, grepping on Linux should just do the trick.

>>>> You will see a lot of lines in the Output, but you should be able to identify the version easily.

Conclusion

If you ask me which is the most convenient method, I would say there is no doubt that the uname command is the easiest. I use the same to Check My Linux Version

Please share with me your experience with Linux.

Источник

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

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

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

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

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

  • Скользящие релизы (rolling);
  • Фиксированные релизы (fixed).

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

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

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

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

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

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

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

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

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

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

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

Или для RPM систем:

rpm -qa | grep openssl

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

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

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

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

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

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

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

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

Выводы

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

Источник

Читайте также:  Windows 10 нужно активировать или нет
Оцените статью