uname command in Linux with Examples
Last Updated :
29 Aug, 2024
Linux, renowned for its open-source flexibility and powerful performance, offers a range of commands that reveal the inner workings of your system. Among these, the ‘uname’ command stands out as a versatile tool that provides key details about your Linux machine. Here, we will learn the basics of the ‘uname’ command, its various options, and how it can help you understand your system better.
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:
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. This is useful for debugging or understanding the exact environment you’re working in.
Syntax:
uname -r
Output:
5. ‘-v’ option in uname Command in Linux
It prints the version of the current kernel, including the build date and time.
Syntax:
uname -v
Output:
6. ‘-m’ option in uname Command in Linux
It prints the machine hardware name of the machine, such as ‘x86_64′ for a 64-bit system.
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 or “unknown” if it can’t be determined.
Syntax:
uname -i
Output:
9. ‘-o’ option in uname Command in Linux
It prints the name of the operating system running on the machine.
Syntax :
uname -o
Output:
Conclusion
In this article, we discussed the ‘uname
'
command that helps you discover essential details 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.
uname command in Linux – FAQs
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.
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.
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.
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
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