Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Getent
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{lowercase|getent}} {{short description|Unix command}} '''getent''' is a [[Unix]] command that helps a user get entries in a number of important [[text files]] called databases. This includes the passwd and group databases which store user information β hence {{code|getent}} is a common way to look up user details on Unix. Since {{code|getent}} uses the same name service as the system, {{code|getent}} will show all information, including that gained from network information sources such as [[Lightweight Directory Access Protocol|LDAP]]. The databases it searches in are: ahosts, ahostsv4, ahostsv6, aliases, ethers (Ethernet addresses), group, gshadow, hosts, netgroup, networks, [[passwd (file)|passwd]], protocols, rpc, services, and shadow. The general syntax is: <syntaxhighlight lang="shell"> getent database [key ...] </syntaxhighlight> [[Thorsten Kukuk]] wrote the ''getent'' utility for the [[GNU C Library]]. == Examples == Fetch list of user accounts on a Unix system (stored in a database called 'passwd'). This will show all user accounts, regardless of the type of [[name service]] used. For example, if both local and LDAP [[name service]] are used for user accounts, the results will include all local and LDAP users: <syntaxhighlight lang="unixconfig" highlight="1"> $ getent passwd root:x:0:0:root:/root:/bin/bash daemon:x:1:1:daemon:/usr/sbin:/bin/sh bin:x:2:2:bin:/bin:/bin/sh sys:x:3:3:sys:/dev:/bin/sh sync:x:4:65534:sync:/bin:/bin/sync games:x:5:60:games:/usr/games:/bin/sh man:x:6:12:man:/var/cache/man:/bin/sh lp:x:7:7:lp:/var/spool/lpd:/bin/sh mail:x:8:8:mail:/var/mail:/bin/sh </syntaxhighlight> Fetch details for a particular user called joe: <syntaxhighlight lang="unixconfig" highlight="1"> $ getent passwd joe joe:x:1000:1000:Joe,,,:/home/joe:/bin/bash </syntaxhighlight> Fetch list of group accounts on a Unix system (stored in a database called 'group'): <syntaxhighlight lang="unixconfig" highlight="1"> $ getent group root:x:0: daemon:x:1: bin:x:2: sys:x:3: adm:x:4:stefan tty:x:5: disk:x:6: lp:x:7: mail:x:8: </syntaxhighlight> ==External links== * [http://linux.die.net/man/1/getent The getent manpage] [[Category:Unix user management and support-related utilities]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Code
(
edit
)
Template:Lowercase
(
edit
)
Template:Short description
(
edit
)