How to Get System Information With uname Command in Linux

How to Get System Information With uname Command in Linux

Hello Geeky, so today we are focusing on How to Get System Information With uname Command in Linux. So please read this tutorial carefully so you may comprehend it in a better helpful way.

Guide: How to Get System Information With uname Command in Linux

The uname command is the first choice when it comes to extracting system information, whether you’re a developer working on a script that requires kernel information or an ordinary user inquisitive about their operating system.

Although uname is reasonably simple to use, the command’s output may appear sophisticated to newcomers at first. This post will show you how to use uname to print fundamental system-related information on Linux to make things easier for you.

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:

uname options

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

Typing uname in the terminal outputs the kernel name.

uname

Output:

Linux

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.

uname -a

Breaking Down the Output

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

Linux kali 5.10.0-kali7-amd64 #1 SMP Debian 5.10.28-1kali1 (2021-04-12) x86_64 GNU/Linux

  • 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:

uname -o

Output:

GNU/Linux

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.

uname –help

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.

Faq

Guide about How to Get System Information With uname Command in Linux


In this guide, we told you about the How to Get System Information With uname Command in Linux; please read all steps above so that you understand How to Get System Information With uname Command in Linux in case if you need any assistance from us, then contact us.

How this tutorial or guide assisting you?


So in this guide, we discuss the How to Get System Information With uname Command in Linux, which undoubtedly benefits you.




Final note

I hope you like the guide How to Get System Information With uname Command in Linux. In case if you have any queries regards this article/tutorial you may ask us. Also, please share your love by sharing this article with your friends and family.

Trickbugs: Get the latest Trick and Tips
Logo
Enable registration in settings - general