Skip to content
Default image

Linux uname command

August 24, 2022

Sometimes you might need some information about your system when troubleshooting some issues that might arise. uname (unix name) is a command that will print basic information about the system hardware and operating system.

The syntax for this command is:

uname [OPTIONS]

When used without any options, the command will show the kernel name, which is linux.

To see all the options that are available for this command you can run uname –help in your terminal or check the man page.

Now let’s have a look at some of the options that can be used with the uname command and see what information they can provide.

uname -s

-s (–kernel-name) shows the same information we get when using the command by itself (without any options).

uname -v

The -v(–kernel-version) will print the kernel version

uname -m

Using the -m(–machine) option will show us the name of the machine hardware.

uname -n

In order to get the system hostname we use the -n(–nodename) option

uname -a

-a (–all) will print all the system information

In order to have a better understanding of what information is displayed, let’s have a closer look at the output. I will break down the output based on my system info, you can run this command on your machine and do the same for your system.

Linux - this is the kernel name that is running on the machine. If we want to print only this info we use the -s option or the uname command without any option

OnTheGo - this is the hostname. The -n option can be used if we need to print only this info

5.10.0-17-amd64 - kernel release. Use the -r(--kernel-release) option in order to show only this info

#1 SMP Debian 5.10.136-1 (2022-08-13) - this is the version of the kernel running on my machine. -v(--kernel-version) option will display this info alone

x86_64 - this is the CPU architecture of the system. In order to print only the name of the machine hardware you can use the uname command with the -m(--machine) option

GNU/Linux - this shows the OS name. -o(--operating-system) can be used in order to show only this information

You can use multiple options while running the uname command. For example, in order to get the same output like the one we got after using the -a option you can use the following:

uname -snrvmo

You can use multiple option in any order you want. The order in which the info is displayed is always the one from the -a option

This is it for this post. Thank you for reading.

Remember that you can always check the manual to see how to use a command and don’t be afraid to google it.