Best 3 Ways To Check Linux OS Version In Command Line


**Articles may contain links that I earn compensation for if clicked and you make a purchase. As an Amazon Associate, I earn from qualifying purchases. These earnings do not actually impact the price of the product or service.

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.

How To Check Linux Version

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?

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

Best 3 Ways To Check Linux OS Version In Command Line 1

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 –

uname -r

Check Linux Kernel Version (2)

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

4.4.0-97-generic

>>>> What does this output mean?

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

Linux Version Command

Best 3 Ways To Check Linux OS Version In Command Line 2

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:
cat /proc/version

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

Linux version 4.4.0-97-generic (buildd@lcy01-33) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017

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

*insert screenshot*

How To Check OS Version In Linux Command Line

Best 3 Ways To Check Linux OS Version In Command Line 3

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.

dmesg | grep Linux

Check OS Version In Linux Command Line

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

[    0.000000] Linux version 4.15.0-47-generic (buildd@lgw01-amd64-028) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.10)) #50~16.04.1-Ubuntu SMP Fri Mar 15 16:06:21 UTC 2019 (Ubuntu 4.15.0-47.50~16.04.1-generic 4.15.18)
[    0.052250] ACPI: Added _OSI(Linux-Dell-Video)
[    0.052250] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    0.052250] ACPI: Added _OSI(Linux-HPI-Hybrid-Graphics)
[    0.061922] ACPI: [Firmware Bug]: BIOS _OSI(Linux) query ignored
[    3.166130] Linux agpgart interface v0.103
[    3.184930] usb usb1: Manufacturer: Linux 4.15.0-47-generic ehci_hcd
[    3.200841] usb usb2: Manufacturer: Linux 4.15.0-47-generic ehci_hcd
[    3.216370] usb usb3: Manufacturer: Linux 4.15.0-47-generic ehci_hcd
[    3.280320] usb usb4: Manufacturer: Linux 4.15.0-47-generic ohci_hcd
[    3.344321] usb usb5: Manufacturer: Linux 4.15.0-47-generic ohci_hcd
[    3.408318] usb usb6: Manufacturer: Linux 4.15.0-47-generic ohci_hcd
[   24.428057] media: Linux media interface: v0.10
[   24.439508] Linux video capture interface: v2.00

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.

Cover Image Credits