previous contents up next

Unix for Advanced Users

5. Navigating effectively

5.4. Who am I?

5.4.1. whoami

Yes, there really are occasions when you will want to ask whoami? If you use
su or use different names on different machines, you may not remember your username at a given time. whoami prints your effective user ID (UID), which is the one that determines your permissions to do operations on files and run programs. Therefore, if you log on as yourself and su to root, whoami will report root.

5.4.2. id

A more flexible command for printing user information is id(1). id gives more detailed output than whoami, writing your numerical user ID as well as your name, plus your group ID and name. Not all Unixes have whoami, so you will sometimes need to use id instead.

previous contents up next