Uname Command in Linux – Examples + Options

Last updated: June 15, 2022

Uname is a Linux command-line utility that displays basic system information. It prints operating system details and machine hardware platform information of your Linux computer.

In this tutorial, we will learn about the uname command and its options to display various system information.

Prerequisites

  • A computer running Linux operating system.
  • Basic understanding of the Linux command line interface.
  • Passion to learn new Linux commands.

Uname Command

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 checks OS details, OS architecture (32 bit or 64 bit), Linux Kernel version, and Kernel release.

When used without any options, the uname command displays the operating system name. However, you can use various options to display specific information, such as -a for all information and -n for network node hostname.

To run uname command, users don't require any special privileges. This is the basic syntax of the uname command:

uname [options]

The uname output:

uname output
Kernel name - Linux.
Host node name - machine01.
Kernel release - 5.14.14-300.fc35.x86_64.
Kernel version and build time - #1 SMP Wed Oct 20 16:14:50 UTC 2021.
x86_64 x86_64 x86_64 - Processor type, hardware platform and architecture of processor.
GNU/Linux - Operating system name.

Uname Command Options

The uname command provides various options to filter out system information. The following table shows some of the most commonly used options of the uname command:

OptionDescription
-aDisplay all information about the operating system, Kernel version, and hardware
-nDisplay only the network node hostname
-sDisplay the Kernel name
-rDisplay the Kernel release version
-vDisplay the Kernel version with date
-mDisplay the hardware platform name of the system
-pDisplay the processor type
-oDisplay the operating system name

Uname Command Examples

The most common example of the uname command is to use it without any options:

uname
uname by default

This example shows only the operating system name, without any version information and distribution name. This is not very helpful when you need to find specific version information.

The following examples show you how to display certain information about your Linux system using the uname command.

Uname -a

The uname -a command can be used to display all system information such as the OS name, version, and Kernel release.

uname -a
output of uname -a

This example output shows that we are running a Linux operating system and the hostname is linux. The Kernel version is 5.13.0.27-generic and this is an Ubuntu Linux distribution. It also shows the time when the Kernel was compiled and Kernel architecture that is x86_64.

Uname -r

The information displayed by the uname -a command is unorganized and could be difficult to read.

If you need specific information about your system Kernel, such as the release number of the Kernel, use uname -r command:

uname -r
output of uname -r

However, if you need to check when this Kernel was compiled, then use:

uname -v
output of uname -v

You can combine uname options to display better information. For example, to display release number and compile date, type:

uname -r -v
output of uname -r -v

Uname -n

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.

uname -n
output of uname -n

The same information can be displayed using the hostname and hostnamectl commands.

Uname -m

The uname command can also be used to display machine hardware name, processor information, and hardware platform information. Use uname -m to print the machine hardware name.

uname -m
output of uname -m

The output of –m, -p, and –i options are often the same:

Uname -o

The uname -o print the operating system name.

For example:

uname -o
output of uname -o

Conclusion

In this tutorial, we learned about the uname command, and its various options that can be used to display a variety of system information. This command works in almost all Linux distributions, such as Ubuntu, Debian, Red Hat, and Fedora.

If you are unable to remember any of the uname options, use --help option to display the help page or browse to man uname command.

uname help page
SHARE

Comments

Please add comments below to provide the author your ideas, appreciation and feedback.

Leave a Reply

Leave a Comment