[Go to CFHT Home Page] Man Pages
Back to Software Index  BORDER=0Manpage Top Level
    getent(1M) manual page Table of Contents

Name

getent - get entries from administrative database

Synopsis

/usr/bin/getent database [ key ... ]

Availability

SUNWnisu

Description

getent gets a list of entries from the administrative database specified by database. The information comes from one or more of the sources that are specified for the database in /etc/nsswitch.conf.

database is the name of the database to be examined. This can be passwd, group, hosts, services, protocols, ethers, or networks. For each of these databases, it uses the appropriate library routines described in getpwnam(3C) , getgrnam(3C) , gethostbyname(3N) , getservbyname(3N) , getprotobyname(3N) , ethers(3N) , and getnetbyname(3N) , respectively.

Each key must be in a format appropriate for searching on the respective database; for example, it can be a username or numeric-uid for passwd, hostname or IP address for hosts, or service, service/protocol, port, or port/proto for services.

getent prints out the database entries that match each of the supplied keys, one per line, in the format of the matching administrative file: passwd(4) , group(4) , hosts(4) , services(4) , protocols(4) , ethers(4) , or networks(4) . If no key is given, all entries returned by the corresponding enumeration library routine (for example, getpwent or gethostent) are printed.

Errors

getent exits with one of the following values:
  1. Successful completion of the task.
  2. Command syntax incorrect, invalid option used, or internal error occurred.
  3. At least one of the specified entry names was not found in the database.
  4. There is no support for enumeration on this database.

Files

/etc/nsswitch.conf
name service switch configuration file
/etc/passwd
password file
/etc/group
group file
/etc/hosts
host name database
/etc/services
Internet services and aliases
/etc/protocols
protocol name database
/etc/ethers
Ethernet address to hostname database or domain
/etc/networks
network name database

See Also

ethers(3N) , getgrnam(3C) , gethostbyname(3N) , getnetbyname(3N) , getservbyname(3N) , getprotobyname(3N) , getpwnam(3C) , nsswitch.conf(4)


Table of Contents