Although uname is fairly easy to use, for beginners, the output of the command might seem sophisticated at first. To make it easier for you, this guide demonstrates how to use uname to print basic system-related information on Linux.

What Is the uname Command?

As mentioned above, uname is a program in Linux and other Unix-based OSes that outputs basic operating system and kernel information in a clean format. Although uname stands for Unix Name, the command has been implemented in various other operating systems as well. The ver command is the Windows Command Prompt equivalent of uname.

The basic syntax of the command is:

…where options are the flags that you can specify in the command.

Typing uname in the terminal outputs the kernel name.

Output:

But that’s not all. Using the -a flag with uname provides complete information about the kernel and the OS. The -a flag stands for All.

Output:

Breaking Down the Output

As you can see, there are multiple fields displayed in the output. Let’s talk about each one by one.

Kernel name: The name of the kernel running on your device. In this case, the kernel name is Linux. Hostname: The second field is reserved for the system hostname. Most Linux distributions allow a user to configure the hostname at the time of installation. Since this is a Kali Linux installation, the default hostname for the system is kali. Kernel release: The next field denotes the kernel release. In the output above, you can see that the kernel release is 5. 10. 0-kali7-amd64. Kernel version: The version of the Linux kernel installed on your computer. In this case, the kernel version is #1 SMP Debian 5. 10. 28-1kali1 (2021-04-12). Machine hardware name: The hardware name is the CPU architecture of your system. In the aforementioned output, x86_64 is the hardware name. Operating system: The last field in the output displays the operating system name. In this case, the OS name is GNU/Linux.

Uname also displays several other fields, such as the processor type and hardware platform of the system. The reason why it didn’t output those particular fields is that the information corresponding to those fields is unknown to the command. Therefore, instead of displaying unknown, the developers chose to strip such fields from the output.

Display Individual Information Using uname

Apart from the -a flag, there are other options that you can use with uname. Each of the additional flags is mapped to a single field and can be used to display that particular field in the output.

For example, if you only want the operating system name, use the -o flag:

Output:

Similarly, you can use the following eight options with uname to output individual fields.

Kernel name: -s Hostname: -n Kernel release: -r Kernel version: -v Machine hardware name: -m Processor: -p Hardware platform: -i Operating system: -o

To get command-line help and display the version information associated with uname, use the –help and –version flags respectively.

Output:

Output:

Nothing is hidden on Linux. Unlike Windows and other operating systems, the source code for Linux is open-source and free to distribute. This means that anyone can access the Linux kernel code and modify it to suit their needs.

However, that demands experience and skills as understanding the kernel source code is not a cakewalk. Someone who is just starting out with the C programming language will have to gain extensive knowledge in development before they can start developing the Linux kernel.