The uname command in Linux displays the system’s basic information. All the Linux distributions are more convenient to manage using the distribution terminal. Though some Linux distributions support the Desktop environment, instead of Linux, users prefer to manage the operating system by running commands.
There are various commands in Linux used for different applications, but in this blog, the explanation of the uname command in Linux will be explored. The post’s content is as follows:
- What is the uname Command on Linux?
- How to Use uname in the terminal?
- Example 1: Display All the System Information
- Example 2: Display the Kernel
- Example 3: Display Only the Hostname
- Example 4: Display the Kernel Version
- Example 5: Display the Machine Hardware
- Example 6: Display the OS Name
Let’s start the guide!
What is the uname Command in Linux?
In Linux, if you are interested in displaying and finding out the basic information of the computer, operating system, kernel, and hostname, then it is recommended to use the uname command.
The general syntax of using the uname command is:
$ uname [options]
The general syntax is easy to understand as type the “uname” command with its different options. The options which can be used with the uname command are explained one by one in the next sections of this blog.
How to Display the Installed Version of uname Command in Linux?
To display the installed version of the uname command in Linux, use the “–version” option with the uname command:
$ uname --version
The version of the installed uname utility has been displayed.
How to Open the help menu of the uname command Utility in Linux?
If you need more information about the uname command, the “–help” option of the uname command can be used:
$ uname --help
The help command has been displayed.
How to Use the uname Command in Linux?
The working can be understood from the basic syntax described in the above section. Let’s practically implement the uname commands with their various options.
Example 1: Display All the System Information
All the information about the computer and its operating system can be displayed with the uname command using the “-a” option. For example, execute the command:
$ uname -a
All basic information of the machine has been displayed.
Example 2: Display the Kernel
To display only the Kernel name with the uname command, use the “-s” option below:
$ uname -s
The Kernal of the machine has been displayed.
Example 3: Display Only the Hostname
Hostname is the name by which the computer is identified in the local network. To display the hostname with the uname command, run the command:
$ uname -n
The hostname “ubuntu” has been displayed.
Example 4: Display the Kernel Version
There are different kernel versions. To find out which version we are using on Linux, use the “-v” option with the uname command:
$ uname -v
The version of the installed kernel has been displayed.
Example 5: Display the Machine Hardware
Machine name is the computer’s hardware, which can be displayed using the “-m” option with the uname command:
$ uname -m
The hardware name has been shown; similarly, if we want to display the processor information of the machine, use the “-p” option:
$ uname -p
The processor type, “x86_64” is being installed in our computer.
Example 6: Display the OS Name
To display the installed operating system, use the “-o” option with the uname command:
$ uname -o
Linux has been installed, which is displayed on the screen.
That’s all about the uname command.
The uname command is used in Linux to display the basic information of the computer, including kernel name, hostname, kernel version, and processor type. The uname utility has some built-in options that serve all the above-stated functionalities. In this blog, the uname command has been explained in detail with its usage in Linux.