whoami

Unix/Linux is a multi-user operating system. It is very important to understand the concept of how user accounts work in order to use any Unix/Linux system effectively. In an Unix environment, you define the access to any file by granting permissions to users. The term ‘user’ in Unix simply refers to someone who has an account in the Unix system thereby allowing him or her to access the system.

You need to understand that:

  • A user has full access to their own files (files created by them).
  • But, limited access to other users’ files.

To check who you are logged in as, you’ll need to use the command whoami. The output of this command will be the user id of the user you are logged in as.

whoami

Output of a whoami command

In the picture above, you can see that output of the whoami command is the user id named parash.

Every user in Unix/Linux environment has a home directory. To find the path to your home directory, you would type the command echo $HOME.

echo $HOME

find path to user's home directory

In the picture above, the output of the echo $HOME command is the path to the user’s home directory i.e /Users/parash.
In Unix/Linux system, $HOME refers to the environment variable that stores the path to a user’s home directory.