{
    "mode": "info",
    "parameter": "id",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/id/json",
    "generated": "2026-11-10T07:18:35Z",
    "sections": {
        "File: coreutils.info,  Node: id invocation,  Next: logname invocation,  Up: User information": {
            "content": "",
            "subsections": [
                {
                    "name": "20.1 'id': Print user identity",
                    "content": "'id' prints information about the given user, or the process running it\nif no user is specified.  Synopsis:\n\nid [OPTION]... [USER]...\n\nUSER can be either a user ID or a name, with name look-up taking\nprecedence unless the ID is specified with a leading '+'.  *Note\nDisambiguating names and IDs::.\n\nBy default, it prints the real user ID, real group ID, effective user\nID if different from the real user ID, effective group ID if different\nfrom the real group ID, and supplemental group IDs.  In addition, if\nSELinux is enabled and the 'POSIXLYCORRECT' environment variable is not\nset, then print 'context=C', where C is the security context.\n\nEach of these numeric values is preceded by an identifying string and\nfollowed by the corresponding user or group name in parentheses.\n\nThe options cause 'id' to print only part of the above information.\nAlso see *note Common options::.\n\n'-g'\n'--group'\nPrint only the group ID.\n\n'-G'\n'--groups'\nPrint only the group ID and the supplementary groups.\n\n'-n'\n'--name'\nPrint the user or group name instead of the ID number.  Requires\n'-u', '-g', or '-G'.\n\n'-r'\n'--real'\nPrint the real, instead of effective, user or group ID.  Requires\n'-u', '-g', or '-G'.\n\n'-u'\n'--user'\nPrint only the user ID.\n\n'-Z'\n'--context'\nPrint only the security context of the process, which is generally\nthe user's security context inherited from the parent process.  If\nneither SELinux or SMACK is enabled then print a warning and set\nthe exit status to 1.\n\n'-z'\n'--zero'\nDelimit output items with ASCII NUL characters.  This option is not\npermitted when using the default format.  When multiple users are\nspecified, and the '--groups' option is also in effect, groups are\ndelimited with a single NUL character, while users are delimited\nwith two NUL characters.\n\nExample:\n$ id -Gn --zero\nusers <NUL> devs <NUL>\n\nPrimary and supplementary groups for a process are normally inherited\nfrom its parent and are usually unchanged since login.  This means that\nif you change the group database after logging in, 'id' will not reflect\nyour changes within your existing login session.  Running 'id' with a\nuser argument causes the user and group database to be consulted afresh,\nand so will give a different result.\n\nAn exit status of zero indicates success, and a nonzero value\nindicates failure.\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}