Hello guys, welcome back to our simple guide series where we learn about Linux tech and how-tos. Today we are going to learn how to check the version of Linux we are using.
Table of Contents –
- Important functions of the Linux kernel
- How to check the version of Linux? Command-line options
- Check Linux distribution version using commands
There are many ways to check which Linux version we are using but the question is what exactly you need? Linux kernel version or Linux distribution version.
Linux kernel acts as the interface between the hardware and processes and performs major operations of the operating system. But Linux kernel is not the operating system itself instead it is the heart of the Linux OS. You can check the version of the Linux kernel which is being used on your system.
The Linux kernel performs major operations of the computer and it is important to know the Linux kernel which you are using. You can check the kernel version by using simple commands which we will discuss further but what exactly are the functions of the Linux kernel?
Important functions of the Linux kernel are –
Memory Management – Linux kernel manages memory and all related operations.
Process Management – CPU management is necessary to determine which process gets to use the CPU and for how long it can use it. There are many scheduling methods which we can discuss in another blog post.
Device Drivers – Acts as an interface between software processes and hardware components.
You can read more on Wikipedia about Linux kernels and their complete documentation. Click here.
The other meaning to check the version of Linux can be more about the whole operating system. There is a major difference between the Linux kernel and the Linux operating system. Linux kernel is the core component of the operating system acting as an interface but Linux operating system is made from Linux kernel, GNU tools and libraries, and software combinations.
How to check the version of Linux? Command-line options
There are many commands to check the kernel version or Linux distribution version on your system using the terminal. This will help you determine which package manager to install and which type and version of Linux distribution you are using.
Checking the Linux Kernel Version using uname –
To check the Linux kernel version, open the terminal window and type the following command,
# uname -mrs
sample output –
root@tinyquip:~# uname -mrs Linux 5.3.0-kali2-amd64 x86_64
Using the above command you can check the Linux kernel version you are using.
Here, 5.3.0-kali2-amd64 signifies the Linux kernel version and also that it uses a 64 bit OS.
Linux kernel version using version file –
You can use the /proc/version file to check the kernel information. To access the version file we will use the cat command and view the file.
Type the following command,
# cat /proc/version
The above command displays the essential kernel information and the sample output is given below.
Linux version 5.3.0-kali2-amd64 (email@example.com) (gcc version 9.2.1 20191109 (Debian 9.2.1-19)) #1 SMP Debian 5.3.9-3kali1 (2019-11-20)
Check Linux Distribution version using commands –
There are again many commands to help you check the Linux version and we have briefly listed them out.
Using the LSB command –
LSB (Linux Standard Base) displays information about the Linux distribution you are currently using.
To use the LSB command for checking the Linux version, type the following.
# lsb_release -a
The output of the above command will be something similar to this,
No LSB modules are available. Distributor ID: Kali Description: Kali GNU/Linux Rolling Release: 2019.4 Codename: kali-rolling
Linux distribution versions are shown as a piece of descriptive information. From the above output, you can notice that I am using Kali GNU/Linux (Rolling.)
You may not need so much information and just want to check the Linux version. I am going to show you how to check the version of Linux with the LSB command which displays only the version.
Type the following command in your terminal,
# lsb_release -d
The output of the above code will show you what Linux version you are using.
Description: Kali GNU/Linux Rolling
In some cases, you might encounter “command not found: lsb_release” and you don’t need to panic in such a situation. There are other methods to check the Linux version.
Check Linux Version using os-release file –
The /etc/os-release file contains useful information such as the OS identification and all the other related additional information about the operating system release. The os-release file can be accessed using the “cat ” command.
Type the following command –
# cat /etc/os-release
The output of this command is given below and you can find the most essential information about the operating system version from this command.
RETTY_NAME="Kali GNU/Linux Rolling" NAME="Kali GNU/Linux" ID=kali VERSION="2019.4" VERSION_ID="2019.4" VERSION_CODENAME="kali-rolling" ID_LIKE=debian ANSI_COLOR="1;31" HOME_URL="https://www.kali.org/" SUPPORT_URL="https://forums.kali.org/" BUG_REPORT_URL="https://bugs.kali.org/"
How to check the version of Linux using the issue file?
The /etc/issue file gets information about the issues if there are any with your operating system. But this command can also check the Linux version.
To use the /etc/issue file to check the Linux version, type the following command.
# cat /etc/issue
The above command is used with cat command and the output is given below –
Kali GNU/Linux Rolling \n \l
It displays that there are no issues with the operating system and also checks the Linux version for you.
This sums up our tutorial to check the Linux version and determine which package manager we wish to install or perform any operation. By now you also know the basic differences between the Linux kernel and Linux distributions. Make sure to know what version you are exactly looking for. The commands listed above are used on Kali Linux which uses a “#” prompt. Other distributions such as ubuntu, centOs, Mint, OpenSUSE, and more may use a different prompt but commands remain the same. If you encounter any problems, let us know in the comment section.
You may also like,