$ su b
Is there a whowasi command? Some way to find out that I was user a before I had become user b?
Technically, you didn't switch users; you opened a separate shell process as b. You can suspend it with suspend, use whoami, then return with fg.
You can check the owner of the parent process with ps -f $PPID.
ps -f $PPID
Use 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 su.)
who am i
Use ps -f to see all processes running on the current tty, including their owners.
You can do a who to see what user is the original owner of the session
Sign up using Google
Sign up using Facebook
Sign up using Stack Exchange
4 years ago