Uname is a linux based command utility tool which is used to display basic information about the operating system and hardware. With options, uname prints kernel details, and system architecture.
In this quick tutorial, I’ll show different kinds of information about the uname command in linux.
You can run Uname without any options and it will just print the core operating system name. The uname command comes with the linux operating system by default.
Table of Contents
Installing the uname command
As we mentioned before, the uname command is available in most GNU / Linux distributions, if in your case this is not the case, let’s see how to install it according to the type of distribution.
When you run uname
command in linux/Unix terminal / console, you might get the following error message:
uname: command not found
To fix this problem, we can install uname using the command line according to the type of your Linux distribution.
Debian and derivatives
sudo apt install coreutils
Fedora and derivatives
sudo dnf install coreutils
Archlinux and derivatives
sudo pacman -S coreutils
Uname command syntax
The uname command corresponds to the following syntax:
uname [options]
The uname options are as follows:
-s
, (--kernel-name
) – Prints the kernel name.-n
, (--nodename
) – Prints the system’s node name (hostname). This is the name the system uses when communicating over the network. When used with the-n
option,uname
produces the same output as thehostname
command.-r
, (--kernel-release
) – Prints the kernel release.-v
, (--kernel-version
) – Prints the kernel version.-m
, (--machine
) – Prints the name of the machine’s hardware name.-p
, (--processor
) – Prints the architecture of the processor.-i
, (--hardware-platform
) – Prints the hardware platform.-o
, (--operating-system
) – Print the name of the operating system. On Linux systems that is “GNU/Linux”-a
, (--all
) – When the-a
option is used,uname
behaves the same as if the-snrvmo
options have been given.
When you try uname command without any options, uname
prints the kernel name, as if the -s
option had been specified:
uname
As you already may know, the name of the kernel is “Linux”:
Linux
Unix/Linux uname command examples
1. How to check uname command version
To check the uname command version, you should use the uname –version command as shown below. As you can see from the output below, the current version of uname is 8.22.
uname -version
2. How to check krnel name using uname command
If you wanted to check the name of the kernel that we have, we have the -s parameter , which prints the name of the Kernel of the operating system.
uname -s
3. How to Check Kernel version
uname -v is the command you need to use to check the kernel version in Linux, as shown below.
uname -v
4. How to check the kernel release using uname command
If you want to check the kernel release then you need to use Use –r option to display the kernel release details. As you can see from below output, current Kernel release version is 3.10.0-1127.10.1.el7.x86_64.
uname -r
5. How to Display all the Linux Kernel Information
To see complete information about the Linux Kernel and machine architecture then you need to use the uname -a command as shown below.
uname -a
uname -a command 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 and the kernel version of the operating system.
In Linux, you can also find the kernel information in the file /proc/version. Just look at the contents of this file:
cat /proc/version
6. How to Print the Current Operating System
If you want to print your current operating system then you need to use the uname -o command as shown below. As you can see from below output, current operating system is GNU/Linux.
uname -o
7. How to Print the Current Hardware Architecture
The uname -i command can be used to determine the hardware architecture. You can see from the below output that the current machine hardware architecture is 64-bit.
uname -i
In an arch based distribution this command will also will show you the architecture for your computer:
arch
8. How to Print the Current Hardware Machine Name
You can check the current hardware machine name by using the uname -m command as shown below. As you can see from the output, the current hardware machine name is x86_64.
uname -m
9. How to print the current node hostname
You can check the hostname of the current node by using the uname -n command, as shown below. From the output below, you can see the current hostname is localhost.
uname -n
9. How to Check man page of uname command
As shown in the following example, you can check the man page of uname by using man uname.
man uname
Conclusion
As part of this tutorial, we learned how to use uname to get kernel, system, hardware, and processor information. For more detailed uname command can be checked on uname Man Page.
if you wan to learn about more linux command you can find it in our linux command Cheatsheet guide.