Shell Scripting: Read entries from administrative database
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
E-mail this to a Friend
Printable Version
You may also be interested in other helpful articles:
- Linux Administrative tasks LPI exam tutorial
- Howto add pause prompt in a shell script ( bash pause command )
- Shell Scripting Hack: cp Command With a Progress bar
- How to use bash without installing bash (get a free shell account)
- How to deal with common PHP database problems
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


please help to learn further