WHOAMI Command in Linux – Prints the Username

In Linux, the “whoami” command is a simple utility that displays the username of the currently logged-in user. It is a basic and frequently used command-line tool that provides information about the user’s identity on a Linux system.

It is an abbreviation for “who am I”.

The command is written by Richard Mlynarik and is part of GNU Coreutils. For complete documentation, run: info coreutils.

WHOAMI Syntax

Below is the syntax of whoami command with input parameters.

whoami [OPTION]…

Options

  • –help:- Print help
  • –version:- Display version information

All the option to this command are optional.

Using WHOAMI Command (Examples)

Check below for additional examples

1. Print the username in Linux

Just enter the whoami command without any option/parameter to display the username for the current userid as shown below.

whoami

Whoam command usage

2. Display Help

–help option displays help about the whoami and exit

whoami --help

whoami help option

3. Print Version

–version displays version information and exit

whoami --version

whoam i version

Summary

The ‘whoami’ command in Linux is a simple yet useful utility that displays the username of the current user executing the command. By typing ‘whoami’ in the terminal and pressing Enter, the command returns the username, which can be helpful for users who manage multiple accounts or need to confirm their active user session.

whoami

This command offers a quick and efficient way to verify the current user without diving into the system’s configuration files or user management tools.

Scroll to Top