Home >System Tutorial >LINUX >How to check the system version in linux

How to check the system version in linux

下次还敢
下次还敢Original
2024-04-11 22:57:161125browse

There are three ways to view the system version in Linux: Use the uname -r command to display only the kernel version. Read the /etc/os-release file to obtain the version number and release information. Use the lsb_release -a command to get information about a Linux distribution, including the version number.

How to check the system version in linux

How to check the Linux system version

In the Linux system, the method to check the system version is very simple.

1. Use the uname command

uname command is one of the most commonly used commands to view system information. To view the system version, you can use the following syntax:

<code>uname -r</code>

This command will only display the kernel version as follows:

<code>4.15.0-112-generic</code>

2. Use /etc/os- release File

/etc/os-release The file contains various information about the Linux distribution, including the version number. To view the system version, you can use the following command:

<code>cat /etc/os-release</code>

This command will display output similar to the following:

<code>PRETTY_NAME="Ubuntu 20.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="20.04"
VERSION="20.04.4 LTS (Focal Fossa)"
VERSION_CODENAME=focal</code>

3. Use the lsb_release command

lsb_release command is designed to display information about Linux distributions. To view the system version, you can use the following syntax:

<code>lsb_release -a</code>

This command will display output similar to the following:

<code>Distributor ID:    Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:    20.04
Codename:    focal</code>

The above is the detailed content of How to check the system version in linux. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn