November 24, 2024

When using Linux Terminal (either in Ubuntu, Linux Mint or any other distribution) it is possible that the current user working at the Terminal will be different then the one that originally logged in.

The below command will display the username that originally logged in to the system.

logname

To know who is the current user at the Terminal, type :

whoami

Both these commands can display different user names. The below example shows current user at Terminal as “root” but originally logged in user as “avp”. (This happens when you login as a normal user and then switch to root access at Terminal or to a different username).

difference between logname and whoami

Knowing these commands can come in handy. To know more about how powerful Linux command line is, refer to the tutorial series starting from here.

 

By admin

Related Post