Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

getent(1) [netbsd man page]

GETENT(1)						    BSD General Commands Manual 						 GETENT(1)

NAME
getent -- get entries from administrative databases SYNOPSIS
getent database [key ...] getcap database [key ...] DESCRIPTION
The getent program retrieves and displays entries from the administrative database specified by database, using the lookup order specified in nsswitch.conf(5). The display format for a given database is as per the ``traditional'' file format for that database. database may be one of: Database Display format disktab entry ethers address name gettytab entry group group:passwd:gid:[member[,member]...] hosts address name [alias ...] netgroup (host,user,domain) [...] networks name network [alias ...] passwd user:passwd:uid:gid:gecos:home_dir:shell printcap entry protocols name protocol [alias ...] rpc name number [alias ...] services name port/protocol [alias ...] shells /path/to/shell If one or more key arguments are provided, they will be looked up in database using the appropriate function. For example, passwd supports a numeric UID or user name; hosts supports an IPv4 address, IPv6 address, or host name; and services supports a service name, service name/pro- tocol name, numeric port, or numeric port/protocol name. If no key is provided and database supports enumeration, all entries for database will be retrieved using the appropriate enumeration func- tion and printed. For cgetcap(3) style databases (disktab, printcap) specifying a key, lists the entry for that key, and specifying more arguments after the key are used as fields in that key, and only the values of the keys are returned. For boolean keys true is returned if the key is found. If a key is not found, then false is always returned. DIAGNOSTICS
getent exits 0 on success, 1 if there was an error in the command syntax, 2 if one of the specified key names was not found in database, or 3 if there is no support for enumeration on database. SEE ALSO
cgetcap(3), disktab(5), ethers(5), gettytab(5), group(5), hosts(5), networks(5), nsswitch.conf(5), passwd(5), printcap(5), protocols(5), rpc(5), services(5), shells(5) HISTORY
A getent command appeared in NetBSD 3.0. It was based on the command of the same name in Solaris and Linux. BSD
October 11, 2011 BSD

Check Out this Related Man Page

GETENT(1)                                                          User Commands                                                         GETENT(1)

NAME
getent - get entries from Name Service Switch libraries SYNOPSIS
getent [option]... database key... DESCRIPTION
The getent command displays entries from databases supported by the Name Service Switch libraries, which are configured in /etc/nss- witch.conf. If one or more key arguments are provided, then only the entries that match the supplied keys will be displayed. Otherwise, if no key is provided, all entries will be displayed (unless the database does not support enumeration). The database may be any of those supported by the GNU C Library, listed below: ahosts When no key is provided, use sethostent(3), gethostent(3), and endhostent(3) to enumerate the hosts database. This is identi- cal to using hosts. When one or more key arguments are provided, pass each key in succession to getaddrinfo(3) with the address family AF_UNSPEC, enumerating each socket address structure returned. ahostsv4 Same as ahosts, but use the address family AF_INET. ahostsv6 Same as ahosts, but use the address family AF_INET6. The call to getaddrinfo(3) in this case includes the AI_V4MAPPED flag. aliases When no key is provided, use setaliasent(3), getaliasent(3), and endaliasent(3) to enumerate the aliases database. When one or more key arguments are provided, pass each key in succession to getaliasbyname(3) and display the result. ethers When one or more key arguments are provided, pass each key in succession to ether_aton(3) and ether_hostton(3) until a result is obtained, and display the result. Enumeration is not supported on ethers, so a key must be provided. group When no key is provided, use setgrent(3), getgrent(3), and endgrent(3) to enumerate the group database. When one or more key arguments are provided, pass each numeric key to getgrgid(3) and each nonnumeric key to getgrnam(3) and display the result. gshadow When no key is provided, use setsgent(3), getsgent(3), and endsgent(3) to enumerate the gshadow database. When one or more key arguments are provided, pass each key in succession to getsgnam(3) and display the result. hosts When no key is provided, use sethostent(3), gethostent(3), and endhostent(3) to enumerate the hosts database. When one or more key arguments are provided, pass each key to gethostbyaddr(3) or gethostbyname2(3), depending on whether a call to inet_pton(3) indicates that the key is an IPv6 or IPv4 address or not, and display the result. initgroups When one or more key arguments are provided, pass each key in succession to getgrouplist(3) and display the result. Enumera- tion is not supported on initgroups, so a key must be provided. netgroup When one key is provided, pass the key to setnetgrent(3) and, using getnetgrent(3) display the resulting string triple (host- name, username, domainname). Alternatively, three keys may be provided, which are interpreted as the hostname, username and domainname to match to a netgroup name via innetgr(3). Enumeration is not supported on netgroup, so either one or three keys must be provided. networks When no key is provided, use setnetent(3), getnetent(3), and endnetent(3) to enumerate the networks database. When one or more key arguments are provided, pass each numeric key to getnetbyaddr(3) and each nonnumeric key to getnetbyname(3) and dis- play the result. passwd When no key is provided, use setpwent(3), getpwent(3), and endpwent(3) to enumerate the passwd database. When one or more key arguments are provided, pass each numeric key to getpwuid(3) and each nonnumeric key to getpwnam(3) and display the result. protocols When no key is provided, use setprotoent(3), getprotoent(3), and endprotoent(3) to enumerate the protocols database. When one or more key arguments are provided, pass each numeric key to getprotobynumber(3) and each nonnumeric key to getprotobyname(3) and display the result. rpc When no key is provided, use setrpcent(3), getrpcent(3), and endrpcent(3) to enumerate the rpc database. When one or more key arguments are provided, pass each numeric key to getrpcbynumber(3) and each nonnumeric key to getrpcbyname(3) and display the result. services When no key is provided, use setservent(3), getservent(3), and endservent(3) to enumerate the services database. When one or more key arguments are provided, pass each numeric key to getservbynumber(3) and each nonnumeric key to getservbyname(3) and display the result. shadow When no key is provided, use setspent(3), getspent(3), and endspent(3) to enumerate the shadow database. When one or more key arguments are provided, pass each key in succession to getspnam(3) and display the result. OPTIONS
-s service, --service service Override all databases with the specified service. (Since glibc 2.2.5.) -s database:service, --service database:service 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.) -i, --no-idn Disables IDN encoding in lookups for ahosts/getaddrinfo(3) (Since glibc-2.13.) -?, --help Print a usage summary and exit. --usage Print a short usage summary and exit. -V, --version Print the version number, license, and disclaimer of warranty for getent. EXIT STATUS
One of the following exit values can be returned by getent: 0 Command completed successfully. 1 Missing arguments, or database unknown. 2 One or more supplied key could not be found in the database. 3 Enumeration not supported on this database. SEE ALSO
nsswitch.conf(5) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2015-04-19 GETENT(1)
Man Page