uname (UNIX name) command in Linux is a simple yet powerful tool that offers information about a Linux machine's operating system and hardware platform. Sysadmins and developers use
uname for troubleshooting and monitoring purposes.
This article provides a comprehensive guide on the
uname command in Linux and its various options.
- A system running Linux. (This tutorial uses Ubuntu 22.04.)
- Access to the terminal.
uname Command Syntax
uname command uses the following basic syntax:
uname [option1] [option2]
When run without any options,
uname prints the Kernel name, the same as using the
However, using the
uname command with specific options provides a more detailed output.
uname Command Options
Options modify the command output by printing specific information, such as the hostname, Kernel release number and version, machine architecture, etc.
The table below is a complete list of the available
uname command options and their descriptions:
|Option (Short Form)||Option (Long Form)||Desription|
|Prints all system information.|
|Prints the Kernel name.|
|Prints the network node hostname.|
|Prints the Kernel release number.|
|Prints the Kernel version.|
|Outputs the machine's architecture type.|
|Prints the CPU type.|
|Prints hardware platform type.|
|Prints the operating system name.|
|n/a||Display a list of all available options.|
uname Command Examples
uname command works with one or more arguments to show different system information. The following sections provide practical examples for the
Show All System Info
uname command with the
-a argument prints all relevant system information. This is how sysadmins usually use the command to get all relevant information with one request.
The output includes the following information:
- Kernel name: Linux.
- Hostname: sara-pnap.
- Kernel release: 5.15.0-58-generic.
- Kernel version and the build date: #64~20.04.1-Ubuntu SMP Fri Jan 6 16:42:31 UTC 2023.
- Machine architecture name: x86_64.
- CPU type: x86_64.
- Hardware platform: x86_64.
- Operating system: GNU/Linux.
Print the Kernel Release Number
uname ˗a command's output is extensive but disorganized and difficult to read. To show specific details about the system, use
uname with different arguments.
For instance, to display only the Kernel release number, use
Check Kernel Version
To check the system's Kernel version, run
uname -v output provides more details about the Kernel than the
uname -r command. The output includes:
- Kernel build number: #64.
- The specific release of the kernel software. In this case, a version of Ubuntu - 20.04.1.
- The OS name: Ubuntu.
- An indicator that the Kernel is designed to run on a computer with multiple processors: SMP (Symmetric Multi-Processing).
- The date and time when the Kernel was built: Fri Jan 6 16:42:31 UTC 2023.
Print System Hostname
uname -n to print the system's hostname. The hostname is a unique name assigned to a computer in a network and used to identify it.
Note: The hostname command prints the same output.
Display Hardware Architecture
uname -m command prints the machine's hardware architecture:
-m option helps understand the system's underlying architecture.
Print CPU Type
uname -p option displays the systems' processor type, which includes information about the system's architecture.
Print Hardware Platform Type
Print the hardware platform type with
uname -i. The hardware platform provides information about the type of hardware the system is running on.
-i arguments often print the same output because these options provide information about the hardware's architecture. However, the specific information each option offers depends on the OS in use.
Print Operating System Name
uname -o to print the OS name:
Combining Command Options
uname options to get a specific combination of system information. For example, to display the Kernel's release number and build date, use the
uname -r -v
To print the Kernel name as well, run:
After reading this article, you should know how the
uname command in Linux works.