Examples of Linux uname Command

Linux uname Command

The uname command in Linux is a versatile tool for obtaining detailed information about your Linux system.

It provides a comprehensive overview of several system components, making it invaluable for system administrators, developers, and users alike.

The Basic Syntax of the Linux uname Command is as follows:

uname [OPTIONs]

Or, uname syntax is like below when combining options:

uname [option1] [option2]

Without any parameters, uname Linux prints the name of the kernel:

uname

Prerequisites to Use Linux uname Command

Provide the options below to let this tutorial work correctly and move on.

  • A Linux VPS running a compatible Linux distribution (e.g., Ubuntu, Debian, CentOS).
  • A non-root user with sudo privileges.
  • Access to Terminal.

Examples of uname Command in Linux Ubuntu and Other distributions

Let’s go through the uname examples to learn about the most frequently used options for the uname command.

In the end, you will know how to use Linux uname Command to view system information like kernel name, hostname, kernel release, version, machine architecture, and processor type.

1. Comprehensive System Overview

The -a option displays comprehensive system information including kernel name, hostname, kernel release, version, machine architecture, processor type, operating system, and distribution.

Syntax:

uname -a

Output:

Linux my-system 5.15.0-52-generic #57-Ubuntu SMP Fri Apr 15 11:08:11 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Which includes the below information:

  • The kernel is Linux.
  • The hostname is my-system.
  • The kernel release is 5.15.0-52-generic.
  • The machine architecture is x86_64.
  • The processor type is x86_64.
  • The operating system is GNU/Linux.

2. Kernel Name

The -s option with the uname command displays the kernel name, typically “Linux”.

Syntax:

uname -s

Output:

Linux

3. Network Node Name

The -n option with the uname command displays the network node name, which is the hostname of the system.

Syntax:

uname -n

Output:

my-computer

The above uname output is an example of the hostname of your system.

4. Kernel Release

The -r option with the uname command displays the kernel release version. This information is useful for identifying the specific kernel running on the system.

Syntax:

uname -r

Output:

5.15.0-52-generic

5. Kernel Version

The -v option with the uname command displays the kernel version, which includes more detailed information than the -r option.

It typically provides additional build details and patch levels.

Syntax:

uname -v

Output:

#57-Ubuntu SMP Fri Apr 15 11:08:11 UTC 2022

This shows the kernel build number, type (SMP), compilation date, and time.

6. Machine Hardware Name

uname is one of the commands you can use to Get System and Hardware Information in Linux.

The -m option with the uname command displays the machine hardware name, which is the processor architecture of the system.

Syntax:

uname -m

Output:

x86_64

This indicates that the system has a 64-bit x86 architecture.

This information is useful for determining compatibility with software and hardware components.

7. Processor Type

The -p option with the uname command displays the processor type.

While the -m option provides the machine architecture, -p offers more specific details about the CPU.

Syntax:

uname -p

Output:

x86_64

Which indicates a 64-bit x86 processor.

The output might be different, providing details like the CPU model or family on systems with more specific processor information.

8. Hardware Platform Type

The -i option displays the hardware platform type.

The sort of hardware the system is operating on is disclosed by the hardware platform.

Syntax:

uname  -i

Output:

x86_64

Note: As you reviewed, since the -m, -p, and -i parameters reveal details about the hardware architecture, they frequently produce the same results.

Nevertheless, the operating system being used determines the precise information that each option provides.

9. Operating system Name

The -o option displays the OS name.

Syntax:

uname -o

Output:

GNU/Linux

How to Combine uname Options and Use them together?

The uname command can also be used in conjunction with many parameters. To find the information you need, you can make any combination of alternatives.

For example, you can print the kernel version and release date by using the uname -r -v command.

uname -r -v

Run the command below to display the Kernel name as well:

uname -srv

Command Options of uname

Here is the uname options table:

OptionDescription
-aDisplay all system information
-sPrint the kernel name
-nPrint the network node hostname
-rPrint the kernel release
-vPrint the kernel version
-mPrint the machine hardware name
-pPrint the processor type
-iPrints hardware platform type.
-oPrints the operating system name.
n/aPrints a list of all available options.

Commands to What is the uname command used for?

The uname command provides information about the system, including kernel name, hostname, kernel release, version, machine architecture, and processor type.

Conclusion

In this article, you reviewed 9 explained examples of uname command Linux. Also, you learned how to combine command options together.

Now, you know how to use uname command in Linux to get the kernel version, find the hostname, and check the system architecture,

 

Leave a Reply

Your email address will not be published. Required fields are marked.