Who Am I Command In Unix

Shell Programming

In Unix, the “who am I” command is a simple yet powerful tool that allows me to quickly identify my current user identity within the system. It provides me with information about my username and the terminal device from which I am currently logged in.

When I enter the “who am I” command in the Unix terminal, it returns the username associated with my current session. This can be extremely useful, especially when I’m working on a multi-user system and need to verify my identity before performing any sensitive tasks.

But how does the “who am I” command actually work behind the scenes? When I execute this command, Unix queries the kernel to retrieve the user identification information associated with the current session. This information is stored in a file called “utmp” or “wtmp”. By accessing this file, Unix can provide me with accurate details about my user identity.

Additionally, the “who am I” command also displays the terminal device from which I am currently logged in. This can be helpful when I’m working on multiple terminal sessions simultaneously and need to keep track of which device I’m using.

Let’s take a closer look at the syntax of the “who am I” command:

$ who am i

Upon executing this command, Unix will output the following details:

  • Username: {my_username}
  • Terminal device: {my_terminal_device}

By displaying this information, the “who am I” command helps me quickly verify my identity and ensure that I am performing actions within the system as the correct user.


The “who am I” command in Unix provides a straightforward way for me to determine my current user identity and terminal device. It plays a crucial role in verifying my identity before performing any sensitive tasks and helps me keep track of my active terminal sessions. Understanding and utilizing this command can greatly enhance my productivity and security when working with Unix systems.