The uname and whoami commands help you understand details like kernel version, name, hostname, etc of the Linux system you are using and what user is currently logged in. Simple yet useful, both the commands are very commonly used by Linux administrators and users alike who work with multiple Linux systems.
Table of Contents
The uname command in Linux
The uname command stands for Unix name. When you use uname
without any options, the command reports the name of the system kernel that the command is being run on.
root@tryit-fluent:~# uname Linux

The “uname -a” option
The -a option gives the complete details of the system and the kernel in use in the following order:
- Kernel name
- Node name
- Kernel Release
- Kernel-Version
- Machine
- Processor (if known)
- Hardware platform (if known)
- Operating System
root@HowLinux:~# uname -a Linux howlinux 4.4.0-170-generic #199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

In the above example:
- Kernel name – Linux
- Node name – HowLinux
- Kernel Release – 4.4.0-170-generic
- Kernel-Version – 199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019
- Machine – x86_64
- Processor (if known) – x86_64
- Hardware platform (if known) – x86_64
- Operating System – GNU/Linux
Print system details individually using options
You can also print each individual detail without having to see all the other information by using options.
1. uname -s for Kernel Name (same output as writing uname without options)
root@HowLinux:~# uname -s Linux

2. uname -n for Nodename
root@HowLinux: ~# uname -n HowLinux

3. uname -r for Kernel Release
root@HowLinux: ~# uname -r 4.4.0-170-generic

4. uname -v for Kernel version
root@HowLinux: ~# uname -v #199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019

5. Some other options
- -m, –machine print the machine hardware name
- -p, –processor print the processor type or “unknown”
- -i, –hardware-platform print the hardware platform or “unknown”
- -o, –operating-system print the operating system
- –help display this help and exit
- –version output version information and exit
The whoami command in Linux
The whoami is a very straightforward command with no customization options. The sole purpose of the command is to find out which user you’re currently logged in as.
On single-user systems, this command is of pretty much no use. But, when working with multiple systems, sudo-ing through multiple users, ssh-ing in multiple systems, you will tend to get lost at times as to what user is currently in use.
root@HowLinux:~# whoami root
