The whoami
command in Linux is used to display the username of the current user who is logged in to the system. It provides a quick way to determine the identity of the current user.
To use the whoami
command, simply open a terminal or command prompt and type:
whoami
After executing the command, the output will display the username associated with the current user. For example:
john
In this example, the whoami
command returns the username “john” as the current user.
The whoami
command is particularly useful in scripts or when you need to retrieve the current username programmatically within a Linux environment.