HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

id — Display current user and group identity. See also: `logname`. More information: <https://www.gnu.org

Submitted by: @import:tldr-pages··
0
Viewed 0 times
currentcommandgroupandidcliuserdisplay

Problem

How to use the id command: Display current user and group identity. See also: logname. More information: <https://www.gnu.org/software/coreutils/manual/html_node/id-invocation.html>.

Solution

id — Display current user and group identity. See also: logname. More information: <https://www.gnu.org/software/coreutils/manual/html_node/id-invocation.html>.

Display current user's ID (UID), group ID (GID), and groups to which they belong:
id


Display the current user identity:
id {{[-un|--user --name]}}


Display the current user identity as a number:
id {{[-u|--user]}}


Display the current primary group identity:
id {{[-gn|--group --name]}}


Display the current primary group identity as a number:
id {{[-g|--group]}}


Display all groups the current user belongs to:
id {{[-Gn|--groups --name]}}


Display an arbitrary user's ID (UID), group ID (GID), and groups to which they belong:
id {{username}}


Skip name lookup and specify the UID number explicitly:
id +{{uid_number}}

Code Snippets

Display current user's ID (UID), group ID (GID), and groups to which they belong

id

Display the current user identity

id {{[-un|--user --name]}}

Display the current user identity as a number

id {{[-u|--user]}}

Display the current primary group identity

id {{[-gn|--group --name]}}

Display the current primary group identity as a number

id {{[-g|--group]}}

Context

tldr-pages: common/id

Revisions (0)

No revisions yet.