FreeKB - Linux Commands getent (view entries)
Linux Commands - getent (view entries)

The getent (get entries) command is similar to the cat command, in that it lets you view the contents of a file. However, the getent command is different from the cat command, in that it can query multipe sources. One of the most common uses of the getent command is when a system is configured with both local authentication and LDAP authentication. In this scenario, the local users will be listed in the /etc/passwd file, and the LDAP users will be on the LDAP server. The getent passwd command will display all of the local user accounts in /etc/passwd and all of the users on the LDAP server. In this example, Bush and Clinton are local user accounts, and Reagan and Clinton are users on the LDAP server.

~]# getent passwd


Likewise, if a system is configured with both local group accounts and LDAP group accounts, the getent group command will list both local groups and groups on the LDAP server.

~]# getent group


Following are a list of common getent commands.

  • getent ahosts
  • getent ahostsv4
  • getent ahostsv6
  • getent aliases (email users)
  • getent ether (Ethernet)
  • getent group
  • getent gshadow (group passwords)
  • getent hosts
  • getent netgroup
  • gettet networks
  • getent passwd (user accounts)
  • getent protocol
  • getent rpc
  • getent services
  • getent shadow (user passwords)


Add a Comment

We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.

Please enter ef825 in the box below so that we can be sure you are a human.


Web design by yours truely - me, myself, and I   |   |