id - return user identity
id [-D] [user] id [-D] -G [-n] [user] id [-D] -g [-nr] [user] id [-D] -p [user] id [-D] -u [-nr] [user]
The id(1) utility displays the user and group names and numeric identifiers (IDs) of the calling process to the standard output. If the real and effective IDs are different, both are displayed; otherwise, only the real ID is displayed.
If you specify a user (by logon name or user ID), id(1) displays the user and group IDs of that user. In this case, the real and effective IDs are assumed to be the same.
|name||The user or group belongs to the system's principal domain.|
|+name||The user or group is a built-in (well-known) user or group, such as Everyone.|
|domain+name||The user or group belongs to a domain other than the principal domain.|
login login_name uid real_user_name euid effective_user_name rgid real_group_name groups group_list
If login_name is the same as real_user_name then the login line is not printed. If the real and effective usernames are the same, then the euid line is not printed. If real and effective groupnames are the same, then the rgid line is not printed. If a 'user is specified on the command line, then only the uid and groups lines are printed.
Note that getlogin(2) always returns a fully qualified user name (domain+user). Fully qualified names for real_user_name, effective_user_name, real_group_name, and group_list may or not be displayed depending if the name is from the principal domain or not. Use the -D option to force the use of fully qualified names.
The traditional Berkeley Software Distribution (BSD) command whoami(1) is the same as
The id(1) utility exits 0 on success, and >0 if an error occurs.