In the vast expanse of the Linux operating system, there are myriad commands and utilities to help users gain insights into their systems. One such command is uname.
In this tutorial, we will learn about the uname command and its options to display various system information.
Uname stands for UNIX name. It is a utility to check the system information of your Linux computer. The uname command is commonly used to check Linux kernel version, kernel release details, and hardware architecture (32-bit or 64-bit). The information from uname comes useful for troubleshooting (identifying potential mismatches), system upgrades (knowing the current kernel version and architecture can be pivotal), and scripting.
When used without any options, the uname command displays only the operating system name. However, you can use various options to display specific system information, such as
-a for all information,
-n for network node hostname,
-r displays the kernel release version, etc.
The basic syntax of the uname command:
Where option indicates a specific type of system information you want to retrieve. Note: The uname command does not require any special privileges. Any user on a Linux or Unix-like system can run
uname to obtain basic system information
Uname Command Options
The following table list some of the useful options of uname with its description.
|Display all available system information.|
|Display only the network node hostname.|
|Display the kernel name.|
|Display the Kernel release version.|
|Display the kernel version build information.|
|Display the hardware platform name of the system.|
|Display the processor type. (This option may not be supported on all platforms.)|
|-i||Display the hardware platform. (This option might not be available on all systems.)|
|Display the operating system name.|
Key Features of Uname
Let's look into the key features provided by uname command.
uname -a command can be used to display all system information such as the kernel name, hostname, kernel version, operating system, etc. This means it gives a comprehensive summary of system information (combines almost all the other options).
Let's dissect the output of -a option:
- Linux: This is the kernel name. It indicates the operating system's kernel. In this case, it's a Linux kernel.
- linuxopsys: This represents the network node hostname of the machine where the command was executed.
- 5.15.0-73-generic: This is the kernel release. It provides detailed versioning of the kernel. This can be especially useful for developers or system admins for compatibility checks or system upgrades.
- #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023: This is part of kernel version information. It goes beyond just the release number to provide more detailed information, including:
- #80: An identifier for this specific kernel build.
- Ubuntu: The distribution or vendor that provided this kernel.
- SMP: Stands for Symmetric Multiprocessing, indicating the kernel supports multi-core/multi-CPU.
- Mon May 15 15:18:26 UTC 2023: The timestamp indicates when this kernel version was compiled or built.
- x86_64: This represents the machine hardware name. In this case, it indicates a 64-bit architecture.
- x86_64 (again): This typically represents the processor type.
- x86_64 (yet again): This can often represent the hardware platform. Note that on many systems, the machine hardware name, processor type, and hardware platform can be the same.
- GNU/Linux: This part indicates the operating system. Here, it's specifying that the OS is a GNU variant of Linux.
The information displayed by the
uname -a command is unorganized and could be difficult to understand each column. Instead, we can use specific options to get our required system information.
Use uname -r command to display the kernel release version.
The output 5.15.0-73-generic, means that the system is currently running this specific kernel version. Where "5.15.0" represents the mainline kernel version (5 major, 15 minor, 0 revision or patch), "-73" indicates a build or distribution-specific patch/update level, and "generic" suffix indicates that this kernel is suitable for general use on various platforms like desktops, laptops, and servers.
You can use -v option to get more specific details, particularly about the build itself. Example:
The output "#80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023" is information about kernel release including the build time.
You can combine -r with -v to get full information about kernel release:
uname -r -v
The output "5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023" is more informative about kernel release.
The hostname is used by the Linux operating system to communicate with other nodes in a network. The
uname -n command can be used to display the hostname of your Linux computer.
The output "linuxopsys" indicates that it is the hostname of the computer or machine I ran the command. The same information can be displayed using the hostname and hostnamectl commands.
The uname command can also be used to display the machine hardware name, processor information, and hardware platform information.
Use uname -m to print the machine hardware name. Essentially, it tells you about the system's underlying hardware architecture.
the output x86_64 indicates a 64-bit architecture on x86 platforms. Most modern desktops and laptops with Intel or AMD processors will display this.
The output of –m, -p, and –i options are often the same.
uname -o print the operating system name.
The output GNU/Linux indicates that the OS is a variant of Linux built upon the GNU system. This is the most common output for Linux distributions.