{
    "content": [
        {
            "type": "text",
            "text": "# getent (man)\n\n## NAME\n\ngetent - get entries from Name Service Switch libraries\n\n## SYNOPSIS\n\ngetent [option]... database key...\n\n## DESCRIPTION\n\nThe  getent  command displays entries from databases supported by the Name Service Switch li‐\nbraries, which are configured in /etc/nsswitch.conf.  If one or more key arguments  are  pro‐\nvided,  then  only the entries that match the supplied keys will be displayed.  Otherwise, if\nno key is provided, all entries will be displayed (unless the database does not support  enu‐\nmeration).\n\n## TLDR\n\n> Get entries from Name Service Switch libraries.\n\n- Get list of all groups:\n  `getent group`\n- See the members of a group:\n  `getent group {{group_name}}`\n- Get list of all services:\n  `getent services`\n- Find a username by UID:\n  `getent passwd 1000`\n- Perform a reverse DNS lookup:\n  `getent hosts {{host}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (9 subsections)\n- **OPTIONS** (8 subsections)\n- **EXIT STATUS**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "getent",
        "section": "",
        "mode": "man",
        "summary": "getent - get entries from Name Service Switch libraries",
        "synopsis": "getent [option]... database key...",
        "tldr_summary": "Get entries from Name Service Switch libraries.",
        "tldr_examples": [
            {
                "description": "Get list of all groups",
                "command": "getent group"
            },
            {
                "description": "See the members of a group",
                "command": "getent group {{group_name}}"
            },
            {
                "description": "Get list of all services",
                "command": "getent services"
            },
            {
                "description": "Find a username by UID",
                "command": "getent passwd 1000"
            },
            {
                "description": "Perform a reverse DNS lookup",
                "command": "getent hosts {{host}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "-s",
                "long": null,
                "arg": null,
                "description": "Override all databases with the specified service. (Since glibc 2.2.5.) --service database:service"
            },
            {
                "flag": "-s",
                "long": null,
                "arg": null,
                "description": "Override only specified databases with the specified service. The option may be used multiple times, but only the last service for each database will be used. (Since glibc 2.4.)"
            },
            {
                "flag": "",
                "long": "--no-idn",
                "arg": null,
                "description": ""
            },
            {
                "flag": "-i",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": "--help",
                "arg": null,
                "description": "-? Print a usage summary and exit."
            },
            {
                "flag": "",
                "long": "--usage",
                "arg": null,
                "description": "Print a short usage summary and exit."
            },
            {
                "flag": "",
                "long": "--version",
                "arg": null,
                "description": ""
            },
            {
                "flag": "-V",
                "long": null,
                "arg": null,
                "description": ""
            }
        ],
        "examples": [],
        "see_also": [
            {
                "name": "nsswitch.conf",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/nsswitch.conf/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": [
                    {
                        "name": "ahostsv4",
                        "lines": 2
                    },
                    {
                        "name": "ahostsv6",
                        "lines": 3
                    },
                    {
                        "name": "aliases",
                        "lines": 12
                    },
                    {
                        "name": "gshadow",
                        "lines": 9
                    },
                    {
                        "name": "initgroups",
                        "lines": 4
                    },
                    {
                        "name": "netgroup",
                        "lines": 6
                    },
                    {
                        "name": "networks",
                        "lines": 9
                    },
                    {
                        "name": "protocols",
                        "lines": 10
                    },
                    {
                        "name": "services",
                        "lines": 9
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-s _",
                        "lines": 3,
                        "flag": "-s"
                    },
                    {
                        "name": "-s _",
                        "lines": 4,
                        "flag": "-s"
                    },
                    {
                        "name": "--no-idn",
                        "lines": 1,
                        "long": "--no-idn"
                    },
                    {
                        "name": "-i",
                        "lines": 1,
                        "flag": "-i"
                    },
                    {
                        "name": "--help",
                        "lines": 2,
                        "long": "--help"
                    },
                    {
                        "name": "--usage",
                        "lines": 2,
                        "long": "--usage"
                    },
                    {
                        "name": "--version",
                        "lines": 1,
                        "long": "--version"
                    },
                    {
                        "name": "-V",
                        "lines": 1,
                        "flag": "-V"
                    }
                ]
            },
            {
                "name": "EXIT STATUS",
                "lines": 10,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "getent - get entries from Name Service Switch libraries\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "getent [option]... database key...\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The  getent  command displays entries from databases supported by the Name Service Switch li‐\nbraries, which are configured in /etc/nsswitch.conf.  If one or more key arguments  are  pro‐\nvided,  then  only the entries that match the supplied keys will be displayed.  Otherwise, if\nno key is provided, all entries will be displayed (unless the database does not support  enu‐\nmeration).\n\nThe database may be any of those supported by the GNU C Library, listed below:\n\nahosts When  no  key is provided, use sethostent(3), gethostent(3), and endhostent(3) to enu‐\nmerate the hosts database.  This is identical to using hosts(5).  When one or more key\narguments are provided, pass each key in succession to getaddrinfo(3) with the address\nfamily AFUNSPEC, enumerating each socket address structure returned.\n",
                "subsections": [
                    {
                        "name": "ahostsv4",
                        "content": "Same as ahosts, but use the address family AFINET.\n"
                    },
                    {
                        "name": "ahostsv6",
                        "content": "Same as ahosts, but use the address family AFINET6.  The call  to  getaddrinfo(3)  in\nthis case includes the AIV4MAPPED flag.\n"
                    },
                    {
                        "name": "aliases",
                        "content": "When  no  key  is  provided, use setaliasent(3), getaliasent(3), and endaliasent(3) to\nenumerate the aliases database.  When one or more key  arguments  are  provided,  pass\neach key in succession to getaliasbyname(3) and display the result.\n\nethers When  one  or  more  key  arguments  are  provided,  pass  each  key  in succession to\netheraton(3) and etherhostton(3) until a result is obtained, and display the result.\nEnumeration is not supported on ethers, so a key must be provided.\n\ngroup  When no key is provided, use setgrent(3), getgrent(3), and  endgrent(3)  to  enumerate\nthe  group  database.   When one or more key arguments are provided, pass each numeric\nkey to getgrgid(3) and each nonnumeric key to getgrnam(3) and display the result.\n"
                    },
                    {
                        "name": "gshadow",
                        "content": "When no key is provided, use setsgent(3), getsgent(3), and  endsgent(3)  to  enumerate\nthe  gshadow  database.  When one or more key arguments are provided, pass each key in\nsuccession to getsgnam(3) and display the result.\n\nhosts  When no key is provided, use sethostent(3), gethostent(3), and endhostent(3)  to  enu‐\nmerate the hosts database.  When one or more key arguments are provided, pass each key\nto  gethostbyaddr(3) or gethostbyname2(3), depending on whether a call to inetpton(3)\nindicates that the key is an IPv6 or IPv4 address or not, and display the result.\n"
                    },
                    {
                        "name": "initgroups",
                        "content": "When one or more key arguments are provided, pass each key in succession  to  getgrou‐\nplist(3) and display the result.  Enumeration is not supported on initgroups, so a key\nmust be provided.\n"
                    },
                    {
                        "name": "netgroup",
                        "content": "When  one  key  is  provided, pass the key to setnetgrent(3) and, using getnetgrent(3)\ndisplay the resulting string triple (hostname, username, domainname).   Alternatively,\nthree  keys  may be provided, which are interpreted as the hostname, username, and do‐\nmainname to match to a netgroup name via innetgr(3).  Enumeration is not supported  on\nnetgroup, so either one or three keys must be provided.\n"
                    },
                    {
                        "name": "networks",
                        "content": "When no key is provided, use setnetent(3), getnetent(3), and endnetent(3) to enumerate\nthe networks database.  When one or more key arguments are provided, pass each numeric\nkey  to getnetbyaddr(3) and each nonnumeric key to getnetbyname(3) and display the re‐\nsult.\n\npasswd When no key is provided, use setpwent(3), getpwent(3), and  endpwent(3)  to  enumerate\nthe  passwd  database.  When one or more key arguments are provided, pass each numeric\nkey to getpwuid(3) and each nonnumeric key to getpwnam(3) and display the result.\n"
                    },
                    {
                        "name": "protocols",
                        "content": "When no key is provided, use setprotoent(3),  getprotoent(3),  and  endprotoent(3)  to\nenumerate  the  protocols database.  When one or more key arguments are provided, pass\neach numeric key to getprotobynumber(3) and each nonnumeric key  to  getprotobyname(3)\nand display the result.\n\nrpc    When no key is provided, use setrpcent(3), getrpcent(3), and endrpcent(3) to enumerate\nthe  rpc database.  When one or more key arguments are provided, pass each numeric key\nto getrpcbynumber(3) and each nonnumeric key to getrpcbyname(3) and  display  the  re‐\nsult.\n"
                    },
                    {
                        "name": "services",
                        "content": "When  no  key is provided, use setservent(3), getservent(3), and endservent(3) to enu‐\nmerate the services database.  When one or more key arguments are provided, pass  each\nnumeric key to getservbynumber(3) and each nonnumeric key to getservbyname(3) and dis‐\nplay the result.\n\nshadow When  no  key  is provided, use setspent(3), getspent(3), and endspent(3) to enumerate\nthe shadow database.  When one or more key arguments are provided, pass  each  key  in\nsuccession to getspnam(3) and display the result.\n"
                    }
                ]
            },
            "OPTIONS": {
                "content": "--service service",
                "subsections": [
                    {
                        "name": "-s _",
                        "content": "Override all databases with the specified service.  (Since glibc 2.2.5.)\n\n--service database:service",
                        "flag": "-s"
                    },
                    {
                        "name": "-s _",
                        "content": "Override  only specified databases with the specified service.  The option may be used\nmultiple times, but only the last service for each  database  will  be  used.   (Since\nglibc 2.4.)\n",
                        "flag": "-s"
                    },
                    {
                        "name": "--no-idn",
                        "content": "",
                        "long": "--no-idn"
                    },
                    {
                        "name": "-i",
                        "content": "",
                        "flag": "-i"
                    },
                    {
                        "name": "--help",
                        "content": "-?     Print a usage summary and exit.\n",
                        "long": "--help"
                    },
                    {
                        "name": "--usage",
                        "content": "Print a short usage summary and exit.\n",
                        "long": "--usage"
                    },
                    {
                        "name": "--version",
                        "content": "",
                        "long": "--version"
                    },
                    {
                        "name": "-V",
                        "content": "",
                        "flag": "-V"
                    }
                ]
            },
            "EXIT STATUS": {
                "content": "One of the following exit values can be returned by getent:\n\n0      Command completed successfully.\n\n1      Missing arguments, or database unknown.\n\n2      One or more supplied key could not be found in the database.\n\n3      Enumeration not supported on this database.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "nsswitch.conf(5)\n\nLinux man-pages 6.7                          2023-11-01                                    getent(1)",
                "subsections": []
            }
        }
    }
}