uname
command is a simple tool that provides information about the kernel, machine, processor, and operating system. There are a lot of more complex and feature applications that can provide more information but the simplicity makes uname best choose.
Syntax
We will use the following syntax for uname
command.
uname [OPTION]...
Help
Brief help can be displayed with the --help
option.
$ uname --help

Display Kernel Name
Kernel name is set by compiling the kernel. Distributions generally provide their name in the kernel name or they set their original versioning convention. We can list kernel name with -s
or --kernel-name
option.
$ uname -s

Display Host Name
We can display the hostname of the system with -n
or --nodename
options. The other name of the hostname is the node name.
$ uname -n

Display Kernel Release
We can display kernel release information. This information may be useful while looking for security vulnerabilities or comp-ability options about the application and kernel-related tools. We will use -r
or --kernel-release
options.
$ uname -r

Display Kernel Version
Kernel version provides information like when the kernel is compiled what distribution is used. We can display kernel version information with –v
option.
$ uname -v

Display Processor
There is a lot of different type of processors in the IT world. ARM, X86, X86_64, MIPS, etc. Each processor architecture requires kernel compiled for its architecture to work. We can get kernel architecture and related processor type with -p
or --processor
options.
$ uname -p

Display Operating System
Operating system information can be listed with -o
option.
$ uname -o

Display All Information
Up to now we have listed and displayed related information part by part. We can print and display all information in a single line with a single option. We will use -a
or --all
option.
$ uname -a

We can see that the current system Linux Kernel version is 4.8
and the operating system is Ubuntu.