Sun. Dec 10th, 2023

Quick Links

Key Takeaways

  • The “uname” command is a useful tool for obtaining basic information about the operating system and hardware platform of a Linux computer.
  • You can use different options with the “uname” command to retrieve specific information like the system hostname, kernel version, and processor architecture.
  • The “uname” command options include “-s” for the kernel name, “-a” for all available system information, and “-r” for the kernel release. You can also combine multiple options together to get the system information you need.

The Linux uname command can display information about the system. You can use different options with the uname command to filter out the specific information you require. The uname command can retrieve information like the system hostname, version of the kernel, and processor architecture.

What Is uname on Linux?

On Linux, uname (derived from “UNIX name”) is a simple command that you can run without any special permission to output basic information about the operating system and hardware platform of your Linux computer. For example, You can use the uname command for troubleshooting, checking system upgrades, scripting, and monitoring purposes. You can also check the kernel release details, Linux kernel version, and hardware architecture (32-bit or 64-bit).

The basic structure for using the uname command is:

uname [OPTION]

Here, you can use the “[OPTION]” parameter to specify the type of information you need. For example, you can use the -a option to show all system information and the -n option for the network node hostname. The uname command has several options, which we will go over below.

When using uname command without any option or argument, it gives you the system’s kernel name:


uname command with no options

When you use the uname command without any option, its output may vary depending on your Linux distribution. For example, some Linux distributions display their name or code name—some will only print “Linux”. It all depends on how developers of each distribution decide to show that information in the uname output.

You can check the installed version of uname command by using the --version option with the uname:

uname --version

uname command with version option

To learn more about uname command options, you can use the --help parameter. This command will display a help message that explains the various options and their usage with the uname command:

uname --help

uname command help

uname Command Options

You can use the uname command with options to display details like machine architecture, the kernel release number and version, hostname, and more. We’ll go over several in detail, but we’ve compiled below a handy reference table of all the relevant options you can use with uname command:

Options Command

Options Name




Displays the kernel name



Shows all available system information, including kernel name, version, processor type, and hardware platform



Displays the kernel release



Shows the hostname or system’s node name



Shows the machine’s architecture type or hardware name



Shows the kernel version



Displays the hardware platform type (Note: Not supported on every system)



Shows the processor or CPU type (Note: Not supported on every system)



Displays the operating system name

Now, you know the uname command options. Let’s jump to the various examples of the uname commands with different options.

You can use the -a or –all option with the uname command to display all system information. It provides a thorough overview of system information.

uname -a

uname command that displays all system information

The output contains the following details:

  • Linux: This specifies that the operating system is Linux.
  • Ubuntu: This shows the network name of the computer or hostname where the command was run.
  • 6.2.0-33-generic: This is the kernel version of the system. It includes the version number, patch level, and a generic identifier.
  • #33~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Sep 7 10:33:52 UTC 2: This part provides additional information about the kernel, such as the build number, release date, and whether it’s a dynamic preemptible kernel.
  • x86_64: This specifies the machine architecture, which in this case is 64-bit (x86_64).
  • x86_64 (again): This represents the CPU or processor type.
  • x86_64 (yet again): This represents the hardware platform. Remember that on various systems, the processor type, hardware platform, and machine hardware name can be the same.
  • GNU/Linux: This indicates that the system is running the Linux kernel and is part of the GNU/Linux operating system.

To print the kernel name, you can either use the uname command without any option or with the -s option. Both these commands will give you the same result.

uname -s

uname command that show kernel name

You can print the current kernel version using the -v option. This option gives you specific details about the kernel version you’re using on Linux.

uname -v

uname command that shows kernel version

The output can be broken down into several components:

  • #33~22.04.1-Ubuntu: This part indicates the Ubuntu kernel build number. It indicates the version of the Ubuntu kernel package that is installed on your system.
  • SMP: This stands for Symmetric Multi-Processing, which means that the kernel supports running on multiple CPUs or CPU cores.
  • PREEMPT_DYNAMIC: This means that the kernel has dynamic preemption enabled. It allows the kernel to switch between tasks more quickly and improve the responsiveness of the system.
  • Thu Sep 7 10:33:52 UTC 2: This is the build date and time of the kernel package.

The -v options give a detailed description of the installed kernel. However, you can also only print the kernel release number using the following command:

uname -r

uname command that displays the kernel release number

Breaking down the above output:

  • 6.2.0: This represents the mainline kernel version (6 major, 2 minor, 0 revision or patch).
  • 33: This specifies a build or distribution-specific patch/update level.
  • generic: This indicates that the kernel is general-purpose and is not specific to any hardware platforms like desktops, laptops, and servers.

You can use the -n option to print the network hostname of your Linux computer. The hostname is a computer’s unique name in a network. Your Linux operating system uses the hostname to communicate with other nodes on the network.

uname -n

command that displays the network node name

You can use the -m option with the uname command to identify the machine’s hardware architecture. It can display the processor information, machine hardware name, and hardware platform information.

uname -m

command that prints the Linux machine hardware

Here, the x86_64 represents the machine hardware name. It is a 64-bit architecture on x86 platforms. This is a common output for most Linux systems with Intel or AMD processors. If you run the command uname -m and it returns the output i686, it means that your computer is using a 32-bit kernel.

The -m,-p, and -i options of the uname command often display identical output. They all provide information related to hardware architecture.

The -o option with the uname shows the name of the operating system. You can either use uname -o or uname -operating system option.

uname -o

command that prints the operating system name

You can see GNU/Linux as the output. It means the operating system is a Linux variant that uses the GNU system as its foundation. This is the most common output for popular Linux distributions.

Using Command Options Together

You can also use multiple options together with the uname command. You can create any combination of options to get the information you are looking for. For example, you can use the uname -r -v command to print both the kernel release date and the kernel version.

uname -r -v

command that prints kernel release date and version

You can also write the options without spaces, such as uname -rv. This will show you the same output as uname -r -v.

uname -rv

command that displays kernel build date and version

Here is another example, you can use the uname -srm command to print the kernel name, the machine architecture, and the kernel release date. This is useful if you want to know what kind of hardware and software your system is running on.

uname -srm

command that displays hardware information

In general, you can use the -a option to print all the system information in one line—as shown in the previous section. But you can also combine multiple options together to get the same output as you get with -a option. Use the uname -snrvmo command to get the same output as the uname -a command return.

uname -snrvmo 

command that displays complete Linux system information

Know Your Linux System Information

You are not limited to the uname command for getting system information. You can also use others multiple Linux commands to get correct information about your Linux system. These Linux commands help you to manage your system more effectively.

Like the uname command, you can use the lshw command to gather information about your hardware components such as CPU, disks, memory, and USB controllers. Managing Linux system storage is important for making sure don’t run short on space. For that, you can use commands like df, fdisk, or mount. These commands give you the details of storage on your system. All these commands can help you to gather specific information related to your Linux system.

Source link

By John P.

Leave a Reply

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