Search notes:

Shell command: id

Prints the user id (gid) and group id (gid) of the user that is running the command. Additionally, it also prints all groups that the user belongs to.

Show names and ids

The following scriptlet shows the the executing user's name and id and group's name and id.
echo "Name    : $(id -u -n)"
echo "User id : $(id -u   )"
echo "Group   : $(id -g -n)"
echo "Group id: $(id -g   )"
Github repository shell-commands, path: /id/show-names-and-ids

See also

Shell commands

Index