Previous Page
Next Page

The getent Command

The getent command is used to get a list of entries from a name service database. The information comes from one of the sources pointed to by the /etc/nsswitch.conf file.

The syntax for the getent command is shown in the following code:

getent database [key...]

The options for the getent command are described in Table 12.10.

Table 12.10. getent Syntax

Option

Description

database

The name of the database to be examined. This can be hosts, group, passwd,ipnodes, services, protocols, ethers, networks, or netmasks.

Key ...

An appropriate key for the specified database. For example, hostname or IP address for the hosts database. Multiple keys can be specified.


The getent command displays the entries of the specified database that match each of the keys. If no key is specified, then all entries are printed. The following example looks at the root entry of the passwd database:

# getent passwd root
root:x:0:1:Super-User:/:/sbin/sh


Previous Page
Next Page