Beginners Guide for Uname Command on Linux

Linux TLDR
Last Updated:
Reading time: 3 minutes

The uname (which stands for β€œUnix Name”) is a commonly used Linux command-line utility to print basic information about the operating system name and system hardware.

The output with the β€œ-a” flag will give you a summary of your system architecture, kernel name, kernel release, kernel version, hardware platform, and many more.

In this quick tutorial, you will learn how to use the uname command and its options to get your desired system information (with practical examples).

Tutorial Details

DescriptionDisplay the Operating System and Hardware Information
Difficulty LevelLow
Root or Sudo PrivilegesNo
OS CompatibilityUbuntu, Manjaro, Fedora, etc.
Internet RequiredNo

Usage of the Uname Command

The uname command takes one argument as an option (optional).

$ uname [OPTION]

Note that most of the options offered by this tool are self explanatory and are mentioned in the following table.

-sKernel Name.
-rKernel Release.
-vKernel Version.
-nNetwork Node Name (Hostname).
-mMachine Architecture.
-pProcessor Architecture.
-iHardware Platform (OS Architecture).
-oOperating System.
-aShow all the Information that Requires the β€œ-snrvmo” Options.

When you invoke this command without specifying any options, it will print the kernel name, which is equal to the β€œ-s” flag.

$ uname


Output of the uname command without option

Now, let’s take a look at a few options offered by this command-line tool.

Display All Available Information Into a Single Output

Most of the time, you will invoke this command in conjunction with the β€œ-a” flag to combine all information into a single output.

$ uname -a


Display all information

The above output contains all the necessary information in the following order:

  • Linux – Kernel name.
  • linux – Hostname.
  • 5.15.0-53-generic – Kernel release.
  • 59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 – Kernel Version.
  • x86_64 – Machine architecture.
  • x86_64 – Processor architecture.
  • x86_64 – Operating system architecture.
  • GNU/Linux – Operating system name.

As you can see, all the information that requires β€œ-snrvmo” flags is printed in the same output using the single option.

Note that the few items that are identical, like the machine, processor, and the operating system’s architecture, are the same in my system but might be different in yours.

Aside from that, you can get all of the information in this output using the desktop manager, but command-line programs have their own benefits (speed is emphasized).

Display the Kernel Information

Unlike the previous example, you can print only the information related to your kernel, like its name (with the β€œ-s” flag), release (with the β€œ-r” flag), and version (with the β€œ-v” flag).

$ uname -srv


Kernel information

Note that the position of the given options doesn’t matter; it can be β€œuname -rvs” or β€œuname -vsr” produce the same output.

Display the Operating System Information

You can print operating system related information, like its hostname (with the β€œ-n” flag), OS architecture (with the β€œ-i” flag), and operating system (with the β€œ-o” flag).

$ uname -nio


Operating system information

Again, the position of the given options doesn’t matter, as all combinations will produce the same output.

Display the Hardware Information

The hardware information, like machine architecture (with the β€œ-m” flag) and processor architecture (with the β€œ-p” flag), will return the output in β€œx86_64” for 64-bit and β€œx86_32” for 32-bit.

$ uname -mp


Hardware information

As you can see from the above picture, both hardware architectures are 64-bit, but it might be different in your case; if you are still using a 32-bit system, then let me know in the comment section.

Wrap Up

Let’s make a few things clear: system architecture is fully dependent upon your system hardware, including the operating system and the kernel.

As for the hostname, it will be the one specified by you; in my case, it was β€œlinuxβ€œ, but in your case, it will be the one specified by you, and this information is pulled from the β€œ/etc/hostname” file.

In addition to that, if you run this command in a virtual machine, the information for processor architecture and OS architecture will possibly return β€œunknown” in the output.

So, that’s all for it; if you have any questions or queries related to this article, then feel free to ask them in the comment section.

Till then, peace!

Join The Conversation

Users are always welcome to leave comments about the articles, whether they are questions, comments, constructive criticism, old information, or notices of typos. Please keep in mind that all comments are moderated according to our comment policy.