ID(1POSIX)
π¦ ID(1POSIX) β like, who even ARE you? (identity reveal, no cap)
okay bestie, welcome to the POSIX Programmer's Manual page for id. π
β οΈ real talk first: this page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ (so go peek at the corresponding Linux manual page for the actual Linux tea β), or honestly the interface might not even be implemented on Linux at all. π
β¨ NAME β¨
id β return user identity π
πΈ SYNOPSIS πΈ
id [user]
id -G [-n] [user]
id -g [-nr] [user]
id -u [-nr] [user]
π DESCRIPTION π
So here's the vibe. If you don't hand it a user operand, id writes the user and group IDs plus the matching user and group names of the invoking process straight to standard output. If the effective and real IDs don't match each other, bestie, it writes both. And if the underlying system supports multiple groups (peep the description of {NGROUPS_MAX} in the System Interfaces volume of POSIX.1β2017), then the supplementary group affiliations of the invoking process get written too. the way it just tells on you. π
Now if you do provide a user operand and the process has appropriate privileges, then the user and group IDs of the selected user get written instead. In that case, effective IDs are assumed to be identical to real IDs (no drama, no mismatch). And if that selected user has more than one allowable group membership listed in the group database, those get written the same way as the supplementary groups we just talked about. slay. β¨
π OPTIONS π
The id utility shall conform to the Base Definitions volume of POSIX.1β2017, Section 12.2, Utility Syntax Guidelines. (yes ma'am, we follow the rules π)
The following options shall be supported:
-Gβ output all different group IDs (effective, real, and supplementary) only, using the format"%u\n". If there's more than one distinct group affiliation, output each such affiliation using the format" %u"before the<newline>is output. π―-gβ output only the effective group ID, using the format"%u\n".-nβ output the name in the format"%s"instead of the numeric ID using the format"%u". names not numbers, we love a rebrand π-rβ output the real ID instead of the effective ID. keeping it real fr fr.-uβ output only the effective user ID, using the format"%u\n".
π«Ά OPERANDS π«Ά
The following operand shall be supported:
userβ the login name for which information is to be written. that's the target, bestie π―
π STDIN π
Not used. nope, not touching it. π«
π INPUT FILES π
None. nothing to see here π
π§ ENVIRONMENT VARIABLES π§
The following environment variables shall affect the execution of id:
LANGβ provide a default value for the internationalization variables that are unset or null. (See the Base Definitions volume of POSIX.1β2017, Section 8.2, Internationalization Variables for the precedence of internationalization variables used to determine the values of locale categories.)LC_ALLβ if set to a non-empty string value, override the values of all the other internationalization variables. she's the main character, she overrides everyone πLC_CTYPEβ determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multi-byte characters in arguments).LC_MESSAGESβ determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error and informative messages written to standard output.NLSPATHβ determine the location of message catalogs for the processing ofLC_MESSAGES.
π ASYNCHRONOUS EVENTS π
Default. boring but valid. β¨
π₯ STDOUT π₯
The following formats shall be used when the LC_MESSAGES locale category specifies the POSIX locale. In other locales, the strings uid, gid, euid, egid, and groups may be replaced with more appropriate strings corresponding to the locale. (glow-up localized edition π)
"uid=%u(%s) gid=%u(%s)\n", <real user ID>, <user-name>,
<real group ID>, <group-name>
If the effective and real user IDs do not match, the following shall be inserted immediately before the '\n' character in the previous format:
" euid=%u(%s)"
with the following arguments added at the end of the argument list:
<effective user ID>, <effective user-name>
If the effective and real group IDs do not match, the following shall be inserted directly before the '\n' character in the format string (and after any addition resulting from the effective and real user IDs not matching):
" egid=%u(%s)"
with the following arguments added at the end of the argument list:
<effective group-ID>, <effective group name>
If the process has supplementary group affiliations or the selected user is allowed to belong to multiple groups, the first shall be added directly before the <newline> in the format string:
" groups=%u(%s)"
with the following arguments added at the end of the argument list:
<supplementary group ID>, <supplementary group name>
and the necessary number of the following added after that for any remaining supplementary group IDs:
",%u(%s)"
and the necessary number of the following arguments added at the end of the argument list:
<supplementary group ID>, <supplementary group name>
If any of the user ID, group ID, effective user ID, effective group ID, or supplementary/multiple group IDs cannot be mapped by the system into printable user or group names, the corresponding "(%s)" and name argument shall be omitted from the corresponding format string. (no name? no (%s). simple as. βοΈ)
When any of the options are specified, the output format shall be as described in the OPTIONS section. periodt. π
π STDERR π
The standard error shall be used only for diagnostic messages. it's for the drama only.
π¦ OUTPUT FILES π¦
None. πΈ
β EXTENDED DESCRIPTION β
None. moving on bestie.
π EXIT STATUS π
The following exit values shall be returned:
0β successful completion. ate. π₯>0β an error occurred. π
π CONSEQUENCES OF ERRORS π
Default.
The following sections are informative. (so like, cute bonus lore, not requirements β¨)
π APPLICATION USAGE π
okay so real concern incoming: output produced by the -G option and by the default case could potentially produce very long lines on systems that support large numbers of supplementary groups. (On systems with user and group IDs that are 32-bit integers and with group names with a maximum of 8 bytes per name, 93 supplementary groups plus distinct effective and real group and user IDs could theoretically overflow the 2048-byte {LINE_MAX} text file line limit on the default output case. It would take about 186 supplementary groups to overflow the 2048-byte barrier using id -G.) This is not expected to be a problem in practice, but in cases where it is a concern, applications should consider using fold -s before post-processing the output of id. π«Ά
π EXAMPLES π
None. (we're not doing homework today π )
π RATIONALE π
The functionality provided by the 4 BSD groups utility can be simulated using:
id -Gn [ user ]
The 4 BSD command groups was considered, but it was not included because it did not provide the functionality of the id utility of the SVID. Also, it was thought that it would be easier to modify id to provide the additional functionality necessary to systems with multiple groups than to invent another command. (why make a new friend when you can just upgrade the one you have π
β¨)
The options -u, -g, -n, and -r were added to ease the use of id with shell commands substitution. Without these options it is necessary to use some preprocessor such as sed to select the desired piece of information. Since output such as that produced by:
id -u -n
is frequently wanted, it seemed desirable to add the options. iconic decision honestly. π
π§ FUTURE DIRECTIONS π§
None. the future is unwritten, bestie. β¨
π SEE ALSO π
fold, logname, who
The Base Definitions volume of POSIX.1β2017, Chapter 8, Environment Variables, Section 12.2, Utility Syntax Guidelines
The System Interfaces volume of POSIX.1β2017, getgid(), getgroups(), getuid()
π COPYRIGHT π
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! π«Ά this one's brought to you by IEEE/The Open Group, 2017 β aka the ID(1POSIX) era, and honestly? she served. go check your own identity, you main character. π
β¨πΈ
π¦ where this page comes from
- debian bookworm: manpages-posix 2017a-2 Β· Other
- debian trixie: manpages-posix 2017a-2 Β· Other
- ubuntu jammy: manpages-posix 2017a-2 Β· Other
- ubuntu noble: manpages-posix 2017a-2 Β· Other
- ubuntu resolute: manpages-posix 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms