
getent - Unix, Linux Command
NAME
getent - get entries from administrative databaseSYNOPSIS
getent database [key ...]DESCRIPTION
The getent program gathers entries from the specified administrative database using the specified search keys. Where database is one of aliases, ethers, group, hosts, netgroup, networks, passwd, protocols, rpc, services or shadow.EXAMPLES
1 - Find which service is using specific port
$ getent services 22 ssh 22/tcp $ getent services 21 ftp 21/tcp $ getent services 25 smtp 25/tcp mail
2 - Get the info for current logged in user
$ getent passwd `whoami` root:x:0:0:root:/root:/bin/bash
3 - Perform reverse DNS lookup
$ getent hosts myhost.mydomain.com 15.77.3.40 myhost.mydomain.com myhost
Advertisements