$ whoami a $ su b Password: ... $ whoami b
Is there a
whowasi command? Some way to find out that I was user
a before I had become user
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Technically, you didn't switch users; you opened a separate shell process as
b. You can suspend it with
whoami, then return with
You can check the owner of the parent process with
ps -f $PPID.
who -m or
who am i to see the user you originally logged in as. (This is different from the above two methods because it always returns the same user despite how many times you run
ps -f to see all processes running on the current tty, including their owners.