1 .\" Copyright (c) 2011, Mark R. Bannister <cambridge@users.sourceforge.net>
2 .\" Copyright (c) 2015, Robin H. Johnson <robbat2@gentoo.org>
4 .\" SPDX-License-Identifier: GPL-2.0-or-later
6 .TH GETENT 1 2021-03-22 "Linux man-pages (unreleased)" "User Commands"
8 getent \- get entries from Name Service Switch libraries
11 .B getent [\fIoption\fP]... \fIdatabase\fP \fIkey\fP...
16 command displays entries from databases supported by the
17 Name Service Switch libraries,
18 which are configured in
19 .IR /etc/nsswitch.conf .
22 arguments are provided,
23 then only the entries that match the supplied keys will be displayed.
26 is provided, all entries will be displayed (unless the database does not
31 may be any of those supported by the GNU C Library, listed below:
42 to enumerate the hosts database.
43 This is identical to using
47 arguments are provided, pass each
51 with the address family
53 enumerating each socket address structure returned.
58 but use the address family
64 but use the address family
68 in this case includes the
80 to enumerate the aliases database.
83 arguments are provided, pass each
86 .BR getaliasbyname (3)
87 and display the result.
92 arguments are provided, pass each
98 until a result is obtained, and display the result.
99 Enumeration is not supported on
113 to enumerate the group database.
116 arguments are provided, pass each numeric
124 and display the result.
134 to enumerate the gshadow database.
137 arguments are provided, pass each
141 and display the result.
151 to enumerate the hosts database.
154 arguments are provided, pass each
157 .BR gethostbyaddr (3)
159 .BR gethostbyname2 (3),
160 depending on whether a call to
164 is an IPv6 or IPv4 address or not, and display the result.
169 arguments are provided, pass each
173 and display the result.
174 Enumeration is not supported on
183 is provided, pass the
189 display the resulting string triple
190 .RI ( hostname ", " username ", " domainname ).
193 may be provided, which are interpreted as the
198 to match to a netgroup name via
200 Enumeration is not supported on
202 so either one or three
214 to enumerate the networks database.
217 arguments are provided, pass each numeric
225 and display the result.
235 to enumerate the passwd database.
238 arguments are provided, pass each numeric
246 and display the result.
256 to enumerate the protocols database.
259 arguments are provided, pass each numeric
262 .BR getprotobynumber (3)
266 .BR getprotobyname (3)
267 and display the result.
277 to enumerate the rpc database.
280 arguments are provided, pass each numeric
283 .BR getrpcbynumber (3)
288 and display the result.
298 to enumerate the services database.
301 arguments are provided, pass each numeric
304 .BR getservbynumber (3)
308 .BR getservbyname (3)
309 and display the result.
319 to enumerate the shadow database.
322 arguments are provided, pass each
326 and display the result.
330 .BR \-s\ \fIservice\fP ", " \-\-service\ \fIservice\fP
331 .\" commit 9d0881aa76b399e6a025c5cf44bebe2ae0efa8af (glibc)
332 Override all databases with the specified service.
335 .BR \-s\ \fIdatabase\fP:\fIservice\fP ", "\
336 \-\-service\ \fIdatabase\fP:\fIservice\fP
337 .\" commit b4f6f4be85d32b9c03361c38376e36f08100e3e8 (glibc)
338 Override only specified databases with the specified service.
339 The option may be used multiple times,
340 but only the last service for each database will be used.
343 .BR \-i ", " \-\-no\-idn
344 .\" commit a160f8d808cf8020b13bd0ef4a9eaf3c11f964ad (glibc)
345 Disables IDN encoding in lookups for
346 .BR ahosts / getaddrinfo (3)
349 .BR \-? ", " \-\-help
350 Print a usage summary and exit.
353 Print a short usage summary and exit.
355 .BR \-V ", " \-\-version
356 Print the version number, license, and disclaimer of warranty for
359 One of the following exit values can be returned by
364 Command completed successfully.
367 Missing arguments, or
374 could not be found in the
378 Enumeration not supported on this
382 .BR nsswitch.conf (5)