coreutils: id invocation
1
1 20.1 ‘id’: Print user identity
1 ==============================
1
1 ‘id’ prints information about the given user, or the process running it
1 if no user is specified. Synopsis:
1
1 id [OPTION]... [USER]
1
1 USER can be either a user ID or a name, with name look-up taking
11 precedence unless the ID is specified with a leading ‘+’. ⇒
Disambiguating names and IDs.
1
1 By default, it prints the real user ID, real group ID, effective user
1 ID if different from the real user ID, effective group ID if different
1 from the real group ID, and supplemental group IDs. In addition, if
1 SELinux is enabled and the ‘POSIXLY_CORRECT’ environment variable is not
1 set, then print ‘context=C’, where C is the security context.
1
1 Each of these numeric values is preceded by an identifying string and
1 followed by the corresponding user or group name in parentheses.
1
1 The options cause ‘id’ to print only part of the above information.
1 Also see ⇒Common options.
1
1 ‘-g’
1 ‘--group’
1 Print only the group ID.
1
1 ‘-G’
1 ‘--groups’
1 Print only the group ID and the supplementary groups.
1
1 ‘-n’
1 ‘--name’
1 Print the user or group name instead of the ID number. Requires
1 ‘-u’, ‘-g’, or ‘-G’.
1
1 ‘-r’
1 ‘--real’
1 Print the real, instead of effective, user or group ID. Requires
1 ‘-u’, ‘-g’, or ‘-G’.
1
1 ‘-u’
1 ‘--user’
1 Print only the user ID.
1
1 ‘-Z’
1 ‘--context’
1 Print only the security context of the process, which is generally
1 the user’s security context inherited from the parent process. If
1 neither SELinux or SMACK is enabled then print a warning and set
1 the exit status to 1.
1
1 ‘-z’
1 ‘--zero’
1 Delimit output items with NUL characters. This option is not
1 permitted when using the default format.
1
1 Example:
1 $ id -Gn --zero
1 users <NUL> devs <NUL>
1
1 Primary and supplementary groups for a process are normally inherited
1 from its parent and are usually unchanged since login. This means that
1 if you change the group database after logging in, ‘id’ will not reflect
1 your changes within your existing login session. Running ‘id’ with a
1 user argument causes the user and group database to be consulted afresh,
1 and so will give a different result.
1
1 An exit status of zero indicates success, and a nonzero value
1 indicates failure.
1