Uname command with examples

Uname command in Linux

1. uname command

The uname command prints information about the system. uname is a portmanteau word made up from "unix" and "name". uname can be called from the command line in Linux as,

uname [OPTION]...

The most common way to use uname is with the -a option, which stands for "all" the information.

$ uname -a
Linux flute 5.0.0-32-generic #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

The contents of the above output, as given by the info command are, kernel-name, node-name, kernel-release, kernel-version, machine, processor, hardware-platform and the operating-system respectively. So we can say that the above uname -a output indicates the following information about the system:

kernel-name: Linux
node-name: flute
kernel-release: 5.0.0-32-generic
kernel-version: #34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019
machine: x86_64
processor: x86_64
hardware-platform: x86_64
operating-system: GNU/Linux

The kernel-release is the release name of the Linux kernel as published on sites like the Linux Kernel Archives. The kernel-version relates to the Linux distribution. So, in this case, it tells that the kernel version is #34~18.04.2-Ubuntu SMP, compiled at Oct 10, 2019, 10:36:02 UTC.

2. uname command examples

2.1 uname

The uname command without any argument prints the kernel name. uname, with the -s option for "system", does the same.

$ uname
Linux
$ uname -s
Linux

2.2 uname -n

uname, with the -n option, prints the network node hostname of the system.

$ uname -n
flute

2.3 uname -r

The -r option prints the kernel release of the system.

$ uname -r
5.0.0-32-generic

2.4 uname -v

The -v option prints the kernel version of the system.

$ uname -v
#34~18.04.2-Ubuntu SMP Thu Oct 10 10:36:02 UTC 2019

2.5 uname -m

With the -m option prints the machine hardware name of the system.

$ uname -m
x86_64

2.6 uname -p

With the -p option prints the processor type of the system. This a non-portable option and might not work in many non-Linux systems.

$ uname -p
x86_64

2.7 uname -i

With the -i option prints the hardware platform of the system. This a non-portable option and might not work in many non-Linux systems.

$ uname -i
x86_64

2.8 uname -o

With the -o option prints the operating system of the system. This a non-portable option and might not work in many non-Linux systems.

$ uname -o
GNU/Linux