Shell Scripting: Read entries from administrative database

by on March 5, 2006 · 1 comment· LAST UPDATED March 5, 2006

in

While scripting it is necessary to gather entries from administrative database such as passwd, group files or services, protocols or networks etc. Traditionally grep is choice of all UNIX administrators but recently I found GNU getent command. The command is quick, saves time:

The getent program gathers entries from the specified administrative database using the specified search keys. For example:

$ getent passwd vivek
$ getnet group admins
$ getent protocols vrrp
$ getent services www

Overall, it supports following databases:

  • ahosts
  • ahostsv4
  • ahostsv6
  • aliases
  • ethers
  • group
  • hosts
  • netgroup
  • networks
  • passwd
  • protocols
  • rpc services
  • shadow
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 1 comment… read it below or add one }

1 vishal June 6, 2008 at 1:34 pm

please help to learn further

Reply

Leave a Comment

Previous post:

Next post: