In my perusing of the system I came across the following command: getent. Now most my searches on the system produced the following results.
# whatis getent
getent: nothing appropriate
I was able to use a –help and find the usage of the command. I further looked on the web and found the following manpage at die.net.
getent(1) – Linux man page
getent – get entries from administrative database
getent database [key ...]
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.
getent is written by Thorsten Kukuk for the GNU C Library.
Well, it would appear that this little gem does not do anything spectacular, but to the contrary a fluid use of this command will save sow command line foo when cutting down the searches in the appropriate file.
For example, lets say you cam across a reference to a port number and wanted to know what it did. Who still uses port 70? So you grep 70 out of the /etc/services directory and get a slew of results, 231 on my system. Sure you can work linjitsu to find only the line you wanted, but using getint you get the following result:
# getent services 70
gopherÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â 70/tcp
It even removes the comment at the end of the line. This is a handy tool in my opinion. Hopefully, you will find a good use for this.