Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top
$ whoami

$ su b
Password: ...

$ whoami

Is there a whowasi command? Some way to find out that I was user a before I had become user b?

share|improve this question
up vote 3 down vote accepted
  • 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.

  • 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.)

  • Use ps -f to see all processes running on the current tty, including their owners.

share|improve this answer
The who am i is exactly what I want. I hadn't realized it returns a different answer from whoami. – chrisaycock Mar 25 '11 at 20:07

You can do a who to see what user is the original owner of the session

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .