9 Examples of Using the uname Command in Linux

Try this guide with our instant dedicated server for as low as 40 Euros

uname Command in Linux

When you need information about the hardware and software components of your Linux system, you have two options.

The first option is to print out the Bash variables such as OSTYPE and HOSTTYPE and run commands like lsb_release. As you can imagine, this approach takes time and you will miss several important pieces of information. 

The second option is to use the uname command in linux that prints out all critical information. It is a great way to explore your Linux system’s specifications and discover important details. 

In this article, we’ll take a beginner-friendly look at uname and you can use the various options of this utility to get to know your Linux system better. 

Let’s start with a brief overview of the utility.

Table Of Contents

  1. What is uname Command in Linux?
    1. uname Command syntax
    2. Options for the uname Command
  2. Examples of the uname Command
    1. The Prerequisites
    2. Example #1: Display All System Information
    3. Example #2: Get The Kernel Release Number
    4. Example #3: Print the Kernel Version
    5. Example #4: Print System Hostname
    6. Example #5: Hardware Architecture
    7. Example #6: Get the CPU Type
    8. Example #7: Print Hardware Platform Type
    9. Example #8: Print the Name of the Operating System
    10. Example #9: Putting the Command Options Together
  3. Conclusion
  4. FAQs

What is uname Command in Linux?

Uname (Unix Name) was created to give you important information about your Linux system. The modern version of this utility is part of the standard GNU Coreutils package. As such, it is already included in all major distributions. 

The utility provides a simple and unified way of accessing information about your system’s hardware architecture, operating system, and kernel version. 

uname Command syntax

The basic syntax of the uname command is as follows:

# uname [option1]

If you run the command without any options, it will print the name of the installed operating system:

# uname


However, you can generate more thorough reports by adding options to the command.

Options for the uname Command

options for uname command

This table offers the most common uname command options and their descriptions:

Examples of the uname Command

Let’s now see how you can use the various options we discussed in the previous section to print information about the system.

The Prerequisites

Here are the simple prerequisites to trying out the following examples:

  • A system running any mainstream Linux distribution.
  • A user account with root or sudo privileges.

Example #1: Display All System Information

You can use the -a option of the uname command to print all important system information. Sysadmins usually use this command to obtain all pertinent data in a single request.

# uname ˗a

uname ˗a

The output of the command on our test system contains the following data:

  • Kernel name: Linux.
  • Hostname: ubuntu22
  • Kernel release: 6.5.0-21-generic
  • Kernel version and the build date: #21~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 9 13:32:52 UTC 2 
  • Machine architecture name: x86_64.
  • CPU type: x86_64.
  • Hardware platform: x86_64.
  • Operating system: GNU/Linux.

Example #2: Get The Kernel Release Number

The output of the uname -a command is very detailed but not well-organized. As such, you may find it tedious if you just want a specific piece of information. 

For instance, if you want to print only the kernel release number, use the -r option. Here is how you can use it in the terminal: 

# uname -r

uname -r

Example #3: Print the Kernel Version

You can get more detailed information about the installed kernel with the -v option that prints the kernel version details.

Enter the following command in the terminal:

# uname -v

uname -v

As you can see, the output contains the following information about the Linux kernel on our test machine:

  • Kernel build number: #21
  • The particular kernel software release. In this case, a version of Ubuntu – 20.04.1.
  • The OS name: Ubuntu.
  • A sign that the kernel is built to function on a multiprocessor computer: SMP (Symmetric Multi-Processing).
  • The date and time when the Kernel was built: Fri Feb 9 13:32:52 UTC 2

Also Read: Get Current Date and Time in Python With 2 Easy Methods

Example #4: Print System Hostname

Use uname -n to print the system’s hostname. 

Note that a machine’s hostname serves as its unique identifier and means of identification on a network.

# uname -n

uname -n

Example #5: Hardware Architecture

We recommend using the following command to get the information about the hardware architecture of the computer:

# uname -m

uname -m

Example #6: Get the CPU Type

We recommend the uname -p command when you need to obtain information about the system’s processor type and related details about its architecture.

# uname -p

uname -p

Example #7: Print Hardware Platform Type

You can print the hardware platform type information with the -i option . The type of hardware the system is running on is revealed by the hardware platform.

# uname -i

uname -i

Important: Because these options offer information on the hardware’s architecture, the -m, -p, and -i parameters frequently produce the same output. The Linux distribution on your system may however dictate the exact data that each option provides.

Example #8: Print the Name of the Operating System

The easiest way of printing the OS name is to use the uname -o command:

# uname -o

uname -o

Example #9: Putting the Command Options Together

You can combine various options of the uname command to get a specific set of system data. We will now discuss two examples that combine these options to print information blocks:

Use the -r and -v options to see the kernel’s build date and release number:

# uname -r -v

uname -r -v

You can extend the previous example to print the kernel name, type:

# uname -srv

uname -srv

Also Read: lsof Command in Linux with Examples


The uname command in Linux is a flexible means of gathering important system data. 

By becoming proficient with the uname command, users can improve their understanding of their Linux environment and facilitate system management, troubleshooting, and compatibility checks. 

It is an essential command for both new and experienced users due to its ease of use and effectiveness, which helps users understand the fundamental features of the Linux operating system.

RedSwitches, your dedicated hosting company, will enhance your hosting experience worldwide. We offer the best dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.


Q. What is the purpose of the uname command in Linux?

The uname command can show system information such as the kernel name, hostname of the network node, kernel release, kernel version, hardware name of the machine, and processor architecture.

Q. How can I check the Linux kernel version using uname?

To view the Linux kernel release version, type uname -r.

Q. What information does uname -a provide?

The comprehensive output that the uname -a command produces includes the system name, node name (hostname), kernel release, kernel version, machine hardware, and processor architecture.

Q. Can uname be used to identify the processor architecture of a Linux system?

The uname—m command can be used to find the computer’s hardware specifications, including the processor architecture.

Q. How do I find out the operating system name using uname?

Use the command uname -o to display the operating system name on a Linux system.

Q. Is there a specific option in uname to show the network node hostname?

Yes, the command uname -n specifically displays the network node hostname.

Q. Can I use uname to identify the machine hardware type on a Linux system?

Yes, details on the system’s hardware, including its type, may be found with the uname -m command.

Q. What does the output of uname -s represent?

The operating system’s system name or kernel name is shown via the uname -s command.

Q. How do I check if a Linux system runs in 32-bit or 64-bit mode with uname?

The command uname -m can be used, and if it shows x86_64, the system is running in 64-bit mode.

Q. Can uname be used in shell scripts for conditional checks?

Uname is commonly used in shell scripts for conditional checks to determine specific system characteristics and adapt script behavior accordingly.

Try this guide with our instant dedicated server for as low as 40 Euros