The getent Command

For the UNIX side of things, we’ll try to feature one command a week that is commonly used in system/user administration on a UNIX box. If anyone wants to contribute more, then we may do one command every two days or ‘Unix Command for the day’. Something like that.

For today, it’s all about getent.

getent is short for Get Entries. The command suppose to get entries from an administrative database. This database can be passwd, group, hosts, ipnodes, services, protocols, ethers, network or netmasks.

For each of these  databases, getent uses the appropriate library routines described in getpwnam, getgrnam, gethostbyaddr, gethostbyname,   getipnodebyaddr, getipnodebyname, getservbyname,  getprotobyname, ethers(3SOCKET), and getnetbyname(3SOCKET), respectively.

getent prints out the database entries that match each of the supplied keys, one per line, int the format of the matching administrive file: Examples, passwd, group, hosts, etc….

Example: To check if a user dpusp or information about the TIT group:

# getent
usage: getent database [ key … ]
# getent passwd dpusp
# getent group TIT


One thought on “The getent Command”

Leave a Reply

Your email address will not be published. Required fields are marked *