Jan 12, 2023 2 min read

Uname Command in Linux

In this tutorial, you will learn about the uname command.

Uname Command in Linux
Table of Contents

Introduction

The uname command is a utility used to print system information. It can be used to print the operating system name, kernel version, and other system information.

In this tutorial, you will use uname command and it's options.

uname Command

The uname command is most widely used to determine the processor architecture, the system hostname, and the version of the kernel running on the system.

The uname command's syntax is displayed as follows:

uname [OPTIONS]...

The options are mentioned below:

  • -s, (--kernel-name) - This option will print the kernel name.
  • -n, (--nodename) - This option will print the system’s node name (hostname). When communicating over the network, the system uses this name. uname returns the same output as the hostname command when used with the -n option.
  • -r, (--kernel-release) - This option will print the kernel release.
  • -v, (--kernel-version) - This option will print the kernel version.
  • -m, (--machine) - This option will print the name of the machine hardware.
  • -p, (--processor) - This option will print the architecture of the processor.
  • -i, (--hardware-platform) - This option will print the hardware platform.
  • -o, (--operating-system) - This option will print the name of the operating system. In the case of Linux systems, it is "GNU/Linux."
  • -a, (--all) - When the -a option is used, uname behaves similarly to when the -snrvmo options have been specified.

uname prints the kernel name when run without any options, exactly as if the -s option had been specified:

uname

The kernel is known as Linux as you may already know:

Output

Linux

You do not need to memorize all the command line options. To print all available information, the uname command is usually used with the -a option:

uname -a
Output

Linux dev.linuxize.com 4.19.0-6-amd64 #1 SMP Debian 4.19.67-2+deb10u1 (2023-01-05) x86_64 GNU/Linux

The following details are included in the output:

  • Kernel name - Linux
  • Hostname - dev.vegastack.com
  • Kernel release - 4.19.0-6-amd64
  • Kernel version - #1 SMP Debian 4.19.67-2+deb10u1 (2019-09-20)
  • Machine hardware name - x86_64
  • Operating system name - GNU/Linux

The options can be combined to achieve the desired output. For instance, you would use the following command to determine what version of the Linux kernel is running on your machine:

uname -srm
Output

Linux 4.19.0-6-amd64 x86_64

When several options are used, the information in the output is displayed in the same order as the -a option. The position of the given options makes no difference. The identical output is generated by both uname -msr and uname -srm.

Conclusion

The uname command prints basic system information. The -a option is commonly used to invoke it and display all information.

If you have any queries, feel free to drop a comment below, and we'll be happy to help.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.