Software & Apps Linux whoami Command: Find the Current User in Linux Find information about your current Linux user account by Gary Newell Writer Gary Newell was a freelance contributor, application developer, and software tester with 20+ years in IT, working on Linux, UNIX, and Windows. our editorial process Gary Newell Updated on June 09, 2020 reviewed by Ryan Perian Lifewire Tech Review Board Member Ryan Perian is a certified IT specialist who holds numerous IT certifications and has 12+ years' experience working in the IT industry support and management positions. our review board Article reviewed on May 18, 2020 Ryan Perian Linux Switching from Windows Tweet Share Email When working in the command line, it's not always clear which user account you're logged in to. For example, when working with an application that requires you to log in as a different user, or when you switch users and lose track of whose credentials are currently active. The whoami command shows you which user account you're logged in to from a terminal window. Here's how to use the whoami command and the id command to find out the currently logged in user. Lifewire / Elise Degarmo Use whoami to Display Your Username To use the terminal window to display the user you're actively logged in as, type the following command: The output of the above command shows the current user, like this: jacob To quickly see how this works with another user account (if you haven't made any other users in Linux), use the sudo command to log in as root: Then, if you run the whoami command again, you'll be told that you're root. How to Do It With id -un In a strange circumstance where whoami isn't installed, there is another command you can use to display your current username. The result is exactly the same as the whoami command, so in this example, it would display jacob. The id command can show more than the current user. It can also show the user id, group id, and groups to which the user belongs. For example, to show only the effective group the user belongs to, type the following: The above command only shows the group id. It doesn't show the group name. To show the effective group name, execute this command: You can display every group id that a user belongs to by entering this: The above command only shows the group ids. You can also use the Linux id command to display the group names: If you want to display your user id without the username, run the following command: More Information You can use the --help switch with either whoami or id to find the current man page for each program. To see the current version of id or whoami, use the following commands: Was this page helpful? Thanks for letting us know! Get the Latest Tech News Delivered Every Day Email Address Sign up There was an error. Please try again. You're in! Thanks for signing up. There was an error. Please try again. Thank you for signing up. Tell us why! Other Not enough details Hard to understand Submit