Uname Command in Linux

FREE Online Courses: Knowledge Awaits – Click for Free Access!

In this article, you will learn everything about Linux uname command. We will be looking into what the uname tool is, a brief history of the command, the syntax we use for the uname command, and the different options we use with the uname command. In the end, we will be looking at some useful practical examples of the uname command.

What is uname command in Linux?

The uname is an abbreviation for “UNIX name”. Uname is a command-line tool in Linux-based operating systems that prints or displays information about the kernel, system architecture, operating system, hardware, version information, and more.

It cannot get any more straightforward: the uname command displays information about the system. It is that simple!

History of Linux uname tool

The uname command made its first appearance in PWB/UNIX. The GNU version of the command is included in the packages Coreutils and sh-utils. It is not a standalone program. David Mackenzie wrote and developed the uname command. The uname command is also available in Windows systems as a part of the GnuWin32 project.

Syntax of Linux uname command

Just like its definition, the syntax of the uname command is also very straightforward and simple:

uname <options>

If we simply run the uname command with no options at all, it only prints the name of the core operating system.

 

 

running uname without any options

Options available with Linux uname command

In the syntax, we have seen that there is a field for options that the uname accepts. When we pair the uname command with different options, uname prints different pieces of information about the system. Let us look at the options used with the uname command:

1. -s

This option prints the kernel name. You can also write this option as “–kernel-name”.

2. -n

This option prints the node name of the system. Node means hostname. The hostname is the name the system uses while communicating over a network. You can also write this option as “–node-name”

3. -r

This option prints the kernel release. You can also write this option as “–kernel-release”.

4. -v

This option prints the version of the kernel in your system. You can also write this option as “–kernel-version”

5. -m

This option prints the name of the hardware in the machine. You can also write this option as “–machine”.

6. -p

This option prints the architecture of the process. You can also write this option as “–processor”.

7. -i

This option prints information about the hardware platform. You can also write this option as “–hardware-platform”.

8. -o

This option prints the name of the operating system. In Linux systems, the operating system name is ‘GNU/Linux’. You can also write this option as “–operating-system”.

9. -a

This option prints all of the information related to the system. If you wanted to print all of the information i.e. kernel name, system’s node name, kernel release, kernel version, hardware, and operating system, instead of typing the commands together as ‘-snrvmo’, you can just use the option “-a”. You can also write this option as “–all”.

10. –version

This option prints information about the version of the uname.

version of uname

11. –help

This option prints the help menu which consists information about the usage and option of the uname command. You can use this option whenever you get stuck and need help regarding the uname command.

help menu of the uname command

Now that we have laid down the fundamentals let us look at some practical commands of the uname command that helps us display different information about the system.

Displaying the name of the kernel

To display the name of the kernel in your system, use the options “-s” or “–kernel-name” with the uname command as follows :

uname -s
uname --kernel-name

displaying the name of the kernel

Displaying the name of the node

To display the name of the node your system uses while communicating over a network, use the options “-n” or “–node-name” with the uname command as follows :

uname -n
uname --node-name

displaying the kernel release

Displaying the kernel release

To display the name of the kernel release of your system, use the options “-r” or “–kernel-release” with the uname command as follows :

uname -r
uname --kernel-release

Displaying the kernel version

To display the version of the kernel in your system, use the options “-v” or “–kernel-version” with the uname command as follows :

uname -v
uname --kernel-version

displaying the kernel version

Displaying the machine’s hardware name

To display the name of the hardware in the machine., use the options “-m” or “–machine” with the uname command as follows :

uname -m
uname --machine

displaying the machine hardware name

Displaying the process architecture

To display the process architecture, use the options “-p” or “–processor” with the uname command as follows :

uname -p
uname --processor

displaying the process architecture

Displaying the hardware platform information

To display the information about the hardware platform, use the options “-i” or “–hardware-platform” with the uname command as follows :

uname -i
uname --hardware-platform

displaying the hardware platform information

Displaying the name of the operating system

To display the name of the operating system your system uses, use the options “-o” or “–operating-system” with the uname command as follows :

uname -o
uname --operating-system

displaying the name of the operating system

Displaying all the information

To display all the above-mentioned information ( kernel name, system’s node name, kernel release, kernel version, hardware, and operating system), use the options “-a” or “-all” with the uname command as follows:

uname -a
uname --all

displaying all the information

Combining options

We can also combine different options to provide specific outputs. Suppose you don’t want all of the information but only want information regarding the system name, kernel release, kernel version, and operating system, you can combine each of the options as follows:

uname -srvo

 

displaying the system name kernel release kernel version and operating system

Similarly, if you want to print information regarding the processor, kernel version, and hostname, you can combine each of the options as follows:

uname -pvi

displaying information regarding the processor kernel version and the hostname

Summary

As you have seen, the uname is a really straightforward simple tool/command that helps in displaying various information about the system like the kernel release, kernel version, system name, node name, operating system, and other information regarding the hardware.

You have learned what the uname tool is, a brief history of the command, the syntax we use for the uname command, the different options we use with the uname command, and some useful practical examples of the uname command.

Your 15 seconds will encourage us to work even harder
Please share your happy experience on Google

follow dataflair on YouTube

Leave a Reply

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