1 .\" Copyright (c) 2011, Mark R. Bannister <cambridge@users.sourceforge.net>
2 .\" Copyright (c) 2015, Robin H. Johnson <robbat2@gentoo.org>
4 .\" %%%LICENSE_START(GPLv2+_DOC_FULL)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
10 .\" The GNU General Public License's references to "object code"
11 .\" and "executables" are to be interpreted as the output of any
12 .\" document formatting or typesetting system, including
13 .\" intermediate and printed output.
15 .\" This manual is distributed in the hope that it will be useful,
16 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
17 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 .\" GNU General Public License for more details.
20 .\" You should have received a copy of the GNU General Public
21 .\" License along with this manual; if not, see
22 .\" <http://www.gnu.org/licenses/>.
25 .TH GETENT 1 2021-03-22 "Linux" "User Commands"
27 getent \- get entries from Name Service Switch libraries
30 .B getent [\fIoption\fP]... \fIdatabase\fP \fIkey\fP...
35 command displays entries from databases supported by the
36 Name Service Switch libraries,
37 which are configured in
38 .IR /etc/nsswitch.conf .
41 arguments are provided,
42 then only the entries that match the supplied keys will be displayed.
45 is provided, all entries will be displayed (unless the database does not
50 may be any of those supported by the GNU C Library, listed below:
61 to enumerate the hosts database.
62 This is identical to using
66 arguments are provided, pass each
70 with the address family
72 enumerating each socket address structure returned.
77 but use the address family
83 but use the address family
87 in this case includes the
99 to enumerate the aliases database.
102 arguments are provided, pass each
105 .BR getaliasbyname (3)
106 and display the result.
111 arguments are provided, pass each
116 .BR ether_hostton (3)
117 until a result is obtained, and display the result.
118 Enumeration is not supported on
132 to enumerate the group database.
135 arguments are provided, pass each numeric
143 and display the result.
153 to enumerate the gshadow database.
156 arguments are provided, pass each
160 and display the result.
170 to enumerate the hosts database.
173 arguments are provided, pass each
176 .BR gethostbyaddr (3)
178 .BR gethostbyname2 (3),
179 depending on whether a call to
183 is an IPv6 or IPv4 address or not, and display the result.
188 arguments are provided, pass each
192 and display the result.
193 Enumeration is not supported on
202 is provided, pass the
208 display the resulting string triple
209 .RI ( hostname ", " username ", " domainname ).
212 may be provided, which are interpreted as the
217 to match to a netgroup name via
219 Enumeration is not supported on
221 so either one or three
233 to enumerate the networks database.
236 arguments are provided, pass each numeric
244 and display the result.
254 to enumerate the passwd database.
257 arguments are provided, pass each numeric
265 and display the result.
275 to enumerate the protocols database.
278 arguments are provided, pass each numeric
281 .BR getprotobynumber (3)
285 .BR getprotobyname (3)
286 and display the result.
296 to enumerate the rpc database.
299 arguments are provided, pass each numeric
302 .BR getrpcbynumber (3)
307 and display the result.
317 to enumerate the services database.
320 arguments are provided, pass each numeric
323 .BR getservbynumber (3)
327 .BR getservbyname (3)
328 and display the result.
338 to enumerate the shadow database.
341 arguments are provided, pass each
345 and display the result.
349 .BR \-s\ \fIservice\fP ", " \-\-service\ \fIservice\fP
350 .\" commit 9d0881aa76b399e6a025c5cf44bebe2ae0efa8af (glibc)
351 Override all databases with the specified service.
354 .BR \-s\ \fIdatabase\fP:\fIservice\fP ", "\
355 \-\-service\ \fIdatabase\fP:\fIservice\fP
356 .\" commit b4f6f4be85d32b9c03361c38376e36f08100e3e8 (glibc)
357 Override only specified databases with the specified service.
358 The option may be used multiple times,
359 but only the last service for each database will be used.
362 .BR \-i ", " \-\-no\-idn
363 .\" commit a160f8d808cf8020b13bd0ef4a9eaf3c11f964ad (glibc)
364 Disables IDN encoding in lookups for
365 .BR ahosts / getaddrinfo (3)
368 .BR \-? ", " \-\-help
369 Print a usage summary and exit.
372 Print a short usage summary and exit.
374 .BR \-V ", " \-\-version
375 Print the version number, license, and disclaimer of warranty for
378 One of the following exit values can be returned by
383 Command completed successfully.
386 Missing arguments, or
393 could not be found in the
397 Enumeration not supported on this
401 .BR nsswitch.conf (5)