How to check the Linux version

When we are using linux, we often need to know the version information of the operating system.


So, how do we check the version information of Linux?

Today, I will show you two ways to check the Linux version:

  • Command line :
    • uname : Displays several system information, including the Linux kernel architecture, name, version, and release.
    • lsb_release : Displays LSB (Linux Standard Base) information about the Linux distribution.
  • System file: (Take ubuntu as an example)
    • /etc/lsb-release : It has the same function as the lsb_release command.
    • /proc/version : Display version information.

Use the command line to check the linux version

Use the uname command

In the following example, we use the linux uname command to print all system information.

➜  ~ uname -a
Linux ubuntu-hostname 5.0.0-38-generic #41-Ubuntu SMP Tue Dec 3 00:27:35 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
➜  ~

Use the lsb_release command

In the following example, we use the linux lsb_release command to print distribution-specific information.

➜  ~ lsb_release -a
Distributor ID:	Ubuntu
Description:	Ubuntu 19.04
Release:	19.04
Codename:	disco

View system files

/etc/lsb-release

This is  Linux distributions information, the “lsb” refers to the Linux Standard Base.

➜  ~ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=19.04
DISTRIB_CODENAME=disco
DISTRIB_DESCRIPTION="Ubuntu 19.04"
➜  ~

/proc/version

➜  ~ cat /proc/version
Linux version 5.0.0-38-generic ([email protected]) (gcc version 8.3.0 (Ubuntu 8.3.0-6ubuntu1)) #41-Ubuntu SMP Tue Dec 3 00:27:35 UTC 2019
➜  ~

Add a Comment

Your email address will not be published. Required fields are marked *