Beginners Guide for Uname Command in 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
Host System and ArchitectureUbuntu 22.10 (x64)
OS Compatibility Ubuntu, Manjaro, Fedora, etc.
Internet RequiredNo
Discussed Tools in this Article

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
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
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
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
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
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.