Cyberithub

12 Popular Unix/Linux uname command examples(How to Check Kernel Version)

Advertisements

In this tutorial, i will take you through 12 Popular Unix/Linux uname command examples and will also explain how to check kernel version using uname command. uname is an open source Linux based command line tool to check the basic information about OS, Kernel and hardware. Usually this utility will be available by default with the Linux Based Systems so you don't have to install it separately. You can also find the use of uname utility with the Bash Scripting where kernel version needs to be checked before running any functions. I will go through all the possible uses of uname command in Linux through various examples.

12 Popular Unix/Linux uname command examples(How to Check Kernel Version)

Unix/Linux uname command examples

Also Read: Solved: errors in crontab File, can't install - Unix & Linux(RHEL/CentOS 7/8)

Example 1: How to Check uname command version

If you want to check uname command version then you need to use uname --version command as shown below. As you can see from below output current uname version is 8.22.

[root@localhost ~]# uname --version
uname (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by David MacKenzie.

--version : output version information and exit. More can be checked on uname Man Page.

Example 2: How to Check Kernel Version Using uname command in Unix/Linux

If you want to check kernel version in linux then you need to use uname -v command as shown below.

[root@localhost ~]# uname -v
#1 SMP Wed Jun 3 14:28:03 UTC 2020

-v : print the kernel version. More can be checked on uname Man Page.

Example 3: How to Check the Kernel Release using uname command in Unix/Linux

If you want to check the kernel release then you need to use uname -r command as shown below. As you can see from below output, current Kernel release version is 3.10.0-1127.10.1.el7.x86_64.

[root@localhost ~]# uname -r
3.10.0-1127.10.1.el7.x86_64

-r : print the kernel release. More can be checked on uname Man Page.

Example 4: How to Display all the Linux Kernel Information

If you want to check complete information about Linux Kernel and machine architecture then you need to use uname -a command as shown below.

[root@localhost ~]# uname -a
Linux localhost 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

-a : print all information. More can be checked on uname Man Page.

Example 5: How to Print the Current Operating System 

If you want to print current operating system then you need to use uname -o command as shown below. As you can see from below output, current operating system is GNU/Linux.

[root@localhost ~]# uname -o
GNU/Linux

-o : print the operating system. More can be checked on uname Man Page.

Example 6: How to Print the Current Hardware Architecture

If you want to check the current hardware architecture then you need to use uname -i command as shown below. As you can see from below output, current machine hardware architecture is of 64-bit.

[root@localhost ~]# uname -i
x86_64

-i : print the hardware platform or "unknown". More can be checked on uname Man Page.

Example 7: How to Print the Current Hardware Machine Name

If you want to check current hardware machine name then you need to use uname -m command as shown below. As you can see from below output, current hardware machine name is x86_64.

[root@localhost ~]# uname -m
x86_64

-m : print the machine hardware name. More can be checked on uname Man Page.

Example 8: How to Print the Node Current Hostname

If you want to check current node hostname then you need to use uname -n command as shown below. As you can see from below output current hostname is localhost.

[root@localhost ~]# uname -n
localhost

-n : print the network node hostname. More can be checked on uname Man Page.

Example 9: How to Print the Current Processor type

If you want to check current processor type then you need to use uname -p command as shown below. As you can see from below output, here processor type is of 64-bit.

[root@localhost ~]# uname -p
x86_64

-p : print the processor type or "unknown". More can be checked on uname Man Page.

Example 10: How to Print the Kernel Name Using uname command

If you want to check current kernel name then you need to use uname -s command as shown below. As you can see from below output, Kernel name is Linux.

[root@localhost ~]# uname -s
Linux

-s : print the kernel name. More can be checked on uname Man Page.

Example 11: How to Check all the Other Options of uname command

If you want to check all the other options available with uname command then you need to use uname --help command as shown below.

[root@localhost ~]# uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.

-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type or "unknown"
-i, --hardware-platform print the hardware platform or "unknown"
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'uname invocation'

Example 12: How to Check man page of uname command

If you want to check the man page of uname command then you need to use man uname command as shown below.

[root@localhost ~]# man uname
UNAME(1) User Commands UNAME(1)

NAME
uname - print system information

SYNOPSIS
uname [OPTION]...

DESCRIPTION
Print certain system information. With no OPTION, same as -s.

-a, --all
print all information, in the following order, except omit -p and -i if unknown:

-s, --kernel-name
print the kernel name

-n, --nodename
print the network node hostname

 

 

 

 

 

For Linux/C#/PHP/HTML/Ruby Tutorials, Check below Posts:-

40 Best Examples of Find Command in Linux

Learn HTML Tables(v5) with Best Examples

Easy Steps to Install GCC(C and C++ Compiler) on CentOS 7

C# data types with Best Examples (.NET v4.7)

How to Transfer Files to an AWS EC2 Instance Using WinSCP in 3 Easy Steps

Learn HTML Image Maps(v5) with Best Examples

How to Install PHP on RedHat/CentOS 7 with Easy Steps

How to Install Ruby on Ubuntu 18.04 with Easy Steps

Leave a Comment