The uname and whoami commands in Linux

Uname And Whoami

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.

Also read: How to Use ls Command in Linux/Unix

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
Uname Default Output 1
uname command output

The “uname -a” option

The -a option gives the complete details of the system and the kernel in use in the following order:

  1. Kernel name
  2. Node name
  3. Kernel Release
  4. Kernel-Version
  5. Machine
  6. Processor (if known)
  7. Hardware platform (if known)
  8. 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 
Uname A Usage 1
uname -a command

In the above example:

  1. Kernel name – Linux
  2. Node name – HowLinux
  3. Kernel Release – 4.4.0-170-generic
  4. Kernel-Version – 199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019
  5. Machine – x86_64
  6. Processor (if known) – x86_64
  7. Hardware platform (if known) – x86_64
  8. 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                                                                                                        
Uname S
uname -s option

2. uname -n for Nodename

root@HowLinux: ~# uname -n                                                                                                       
Uname N
uname -n output

3. uname -r for Kernel Release

root@HowLinux: ~# uname -r                                                                                                       
Uname R
uname -r for Kernel Release

4. uname -v for Kernel version

root@HowLinux: ~# uname -v                                                                                                       
#199-Ubuntu SMP Thu Nov 14 01:45:04 UTC 2019 
Uname V
uname -v output

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 command in Linux is straightforward 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, the whoami command in Linux is of 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                                                                                                          

What does the command uname print when you run it without any option?

When used without any options, the uname command will print the Kernel name.

What is whoami command in Linux used for?

The whoami command helps you identify the username that you’re logged in as. This is especially useful for system admins who work on multiple devices while logging in through SSH.


Both the uname and whoami commands can be handy when you’re working with multiple systems. It helps you identify the machine you’re working on and the privileges you have. While we’re on the topic of multiple systems, here’s an article you can read next on using ssh to connect to remote systems.