Open In App

uname command in Linux with Examples

Last Updated : 18 Dec, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Linux, the operating system known for its open-source nature and robust capabilities, has an array of commands that unlock the secrets of your system. Among these, the `uname` command is a versatile tool that lets you peek under the hood and discover essential information about your Linux machine. In this guide, we’ll take a beginner-friendly journey into the world of `uname` and explore how it can unravel the mysteries of your Linux system.

What is uname Command in Linux?

Let’s start with the basics. The term “uname” stands for “Unix Name,” and the command itself is designed to provide you with key details about your Linux system. It’s like asking your computer, “Hey, who are you, and what are you made of?” The answers you get can help you understand your system’s kernel version, operating system, hardware architecture, and more. This command ‘uname‘ displays the information about the system.

Syntax of uname Command in Linux

The basic syntax of uname command is as follows:

uname [OPTIONs]

Options and Examples of uname Command in Linux

Options

Description

-a or --all

Displays all available information.

-s or --kernel-name

Shows the kernel name.

-n or --nodename

Displays the network (domain) name of the machine.

-r or --kernel-release

Shows the kernel release.

-v or --kernel-version

Displays the kernel version.

-m or --machine

Shows the machine hardware name.

-p or --processor

Displays the processor type or “unknown.”

-i or --hardware-platform

Shows the hardware platform or “unknown.”

-o or --operating-system

Displays the operating system.

1. -a option in uname Command in Linux

It prints all the system information in the following order: Kernel name, network node hostname, kernel release date, kernel version, machine hardware name, hardware platform, operating system.

Syntax:

uname  -a

Output:

2. -s option in uname Command in Linux

It prints the kernel name.

Syntax:

uname  -s

Output:

3. -n option in uname Command in Linux

It prints the hostname of the network node(current computer).

Syntax:

uname  -n

Output:

4. -r option in uname Command in Linux

It prints the kernel release date.

Syntax:

uname  -r

Output:

5. -v option in uname Command in Linux

It prints the version of the current kernel.

Syntax:

uname  -v

Output:

6. -m option in uname Command in Linux

It prints the machine hardware name.

Syntax:

uname  -m

Output:

7. -p option in uname Command in Linux

It prints the type of the processor.

Syntax:

uname  -p

Output:

8. -i option in uname Command in Linux

It prints the platform of the hardware.

Syntax:

uname  -i

Output:

9. -o option in uname Command in Linux

It prints the name of the operating system.

Syntax :

uname  -o

Output:

Frequently Asked Questions

1. What is the Purpose of the uname Command in Linux?

The uname command in Linux is used to retrieve essential information about the system. It provides details such as the kernel name, version, machine hardware name, operating system, and more. It is a versatile tool commonly used for system identification and scripting purposes.

2. How can I Check the Linux Kernel Version using uname?

To check the Linux kernel version, you can use the following command:

name -r

This will display the kernel release information, giving you insights into the version of the Linux kernel running on your system.

3. What is the Difference Between uname -a and uname -s?

The uname -a command provides all available information about the system, including the kernel name, version, machine architecture, and more. On the other hand, uname -s focuses solely on the kernel name. So, while uname -a gives a comprehensive overview, uname -s provides a more specific piece of information.

4. Can uname Help Identify the System Architecture?

Yes, the uname command can help identify the system architecture. The option -m or --machine provides information about the machine hardware name, including details about whether the system is running on a 32-bit or 64-bit architecture.

uname -m

5. How Do I Determine the Operating System Using uname?

To determine the operating system, you can use the -o or --operating-system option with the uname command. This will display the operating system name.

uname -o

Conclusion

In this article we discussed the uname command in Linux which is like asking your computer, “Hey, who are you?” It tells you important things about your system, like the type of operating system, the version of the kernel, and details about the hardware. It’s a helpful tool for beginners to understand what’s going on in their Linux machine. The command has different options (like -a or -s) that give specific information. For example, uname -a shows all details, while uname -s just tells you the kernel name. This guide and examples aim to make it easy for everyone, from beginners to experts, to explore and understand their Linux systems better.



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads