A Detailed Tutorial on How to Check Linux Version
A Linux OS is built on the Linux kernel, GNU tools, tools, and libraries. Today, many developers are using Linux for building and running mobile applications. Linux has played an essential role in developing affordable devices like Chromebooks that help run the OS on the kernel. You can use Linux within the cloud computing and server environments due to various reasons, as mentioned below:
- The developers of other communities support Linux’s distributions.
- You can efficiently run the Linux kernel on a wide range of hardware. You can even install it with pre-existing systems.
- It allows you to install the centralized software from the pre-existing repositories.
- Linux does not require high resources and has a low requirement.
- It is strongly recommended while creating application ecosystems, tools for the server.
- Linux can easily sustain necessary changes to the operating system behaviors.
- Linux is free and open-source, making it simple for the developers to choose it for practical reasons.
- Some developers use Linux due to its features like accessibility and ensure freedom of expression.
- The broad Linux community is also an excellent influence for some developers. Whenever developers have any queries or problems, they can consult the community results and feedback on the particular issue or reach out directly to one of many active developers to get your query resolved.
A Brief Introduction to Linux
After introducing UNIX in 1969, Richard Stallman was inspired to create a non-proprietary alternative to the UNIX. He started working on the GNU project while working at MIT’s Artificial Intelligence Lab. In 1984, he left the laboratory work for distributing the GNU components as free software. The GNU kernel, also known as the GNU HURD, had gained the Free Software Foundation’s focus. FSF was founded and headed in 1985 by Stallman.
Another developer, Linus Torvalds, an undergraduate from Finnish, worked on the free alternative to UNIX. After he fed up with the licensing for MINIX, In 1991, he announced that he was working on an operating system resembling MINIX. Initially, he developed on MINIX using a C compiler. Linux has become a unique project with some developers who released Linux kernel version 1.0 with Torvalds in 1994.
Torvalds used GNU code and a C compiler from GNU; his kernel and many Linux distributions are built on the GNU components. Later Stallman expanded the term Linux to GNU/Linux as it describes both the role of the GNU involvement in the development of the Linux and the in-depth concept of fostering the GNU project Linux kernel. Even today, Linux distributions indicate the presence of both the Linux kernel and GNU elements.
Key Features of Linux
Though the Linux kernel has taken many concepts, features, and properties from Unix, you can still differ Linux system from the earlier UNIX system in the following ways:
- Linux’s core component, called the kernel, was created independently from other OS components. It makes Linux borrow different elements from various sources like GNU to create a complete operating system.
- Linux is an open-source operating system that is developed and maintained by a group of developers. The Linux kernel is licensed under the GNU General Public License, allowing the community developers to download and make any required changes. The GPL ensures that further changes and work must also maintain the original software license.
- Like UNIX, Linux also has a monolithic kernel architecture. But Linux kernels can be loaded and unloaded dynamically on demand.
- Unlike UNIX, Linux comes with symmetrical multiprocessor support, allowing you to access multiple processors using the single operating system, sharing the main memory and access to all I/O devices.
- Unlike Unix, Linux’s kernel is preemptive, allowing the scheduler to force a context switch on a driver or another kernel part while executing.
- Linux kernel does not maintain any difference between the threads and normal running processes.
- Linux comes with an interactive Command Line Interface and a Graphical user interface for user interactivity.
By 2020, there are more than 500 unique Linux distributions. The most popular and commonly used distributions are Ubuntu, Debian, Fedora, Linux Mint, SUSE, etc. If we consider the family tree of Ubuntu, it contains more than 65 software applications alone.
Below are some commonly used Linux distributions and the cases where they are used.
It mostly works as a Mac operating system and is easy to use.
It mostly works like windows OS and is commonly used by newcomers.
It provides high stability but is not recommended for new users in the market.
You can use this distro if you want to work on a red hat and the latest software.
This distro works well for commercial purposes.
You can use this distro if you want to work on a red hat without its trademark.
It mostly works the same as Fedora distro but slightly older and more stable distro.
It is not suitable for beginners because you have to install every package yourself.
Checking the Linux version
Whenever you log in to the Linux system, it is recommended that you check the Linux version running on the system before you start working. It is important because knowing the Linux distribution will help you to understand what package manager you will require to install new software and packages. We will now check the Linux distribution and version installed on your system by running the commands on the Command Line Interface (CLI). If you want to check the Linux version details, then consider the following two words:
- The version number of the distribution
- The version of the Linux kernel
To check the above two values, you need to run Linux commands using shells that will act as the interface between the system and the user.
Checking Distribution Version Number
This command will display the LSB (Linux Standard Base) details about the Linux distribution running on your system. You can use this command on all available Linux distributions, but it requires installing the lsb-release package.
(installing lsb package)
apt-get -y install lsb-core
$ lsb_release -a
The output will display the Linux distribution and the version mentioned in the description line of the output.
If you do not want to display all the above output information, run the below command to get the description line only. You can switch the ‘-a’ parameter with ‘-d’.
$ lsb_release -d
In case you get an error like “command not found: lsb_release,” you can use another method to check the Linux version and distribution.
This file will contain the OS identification data that includes the information on the Linux distribution. This file comes as a part of the systemd package that is available on all systems running systemd. If you want to see this file’s content, use the cat or less command below.
$ cat /etc/os-release
This file contains a system identification number that is displayed before the login prompt. This file usually contains the information on the Linux version. You can view the content using the cat or less command as mentioned below.
This command is the systemd utility and is used to check and modify the system hostname. This command will also provide you with the Linux distribution and kernel version details. You can run the below command to get the details.
If you do not get the required information using any of the above commands, you can use it. It may be due to the old and outdated Linux distribution you are using. You can run any of the below commands to display the information on the distribution release and the version number.
$ cat /etc/*release
$ cat /etc/*version
Checking the Linux Kernel Version Number
This command will display the system’s various information and the Linux kernel architecture, name, version, and release. You can run the below command to get all the details.
$ uname -srm
It means you are using the Linux kernel, which is 64-bit with version- 4.9.0-8-amd64
If you want to know just the kernel version, you can run the below command.
$ uname -r
To get detailed information on the kernel version, you can use the ‘-a’ parameter with the uname command below.
$ uname -a
OutputDarwin Simrans-MacBook-Air.local 20.3.0 Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64 x86_64
There is no doubt that Linux is the most commonly used operating system. It comes with various distributions suitable for different purposes. Before working on your system, you must know the Linux distribution and version running on the system. It might help you while installing packages and software for that particular distribution or kernel. There might be a possibility that all the software you install is not compatible with all distributions. It is better to know which software is compatible with your existing Linux system.
You can use this article to understand the different commands you can run for checking the distribution and version number of the Linux OS. all these commands are applicable for all distributions. Hence, there is nothing to worry about searching for various Linux commands.