Retrieve entries from Name Service Switch libraries.
getent [options] database [key ...]
-h, --help # Display help information
-i, --no-idn # Disable IDN encoding in lookups
-s, --service # Service to use for lookups
-V, --version # Display version information
The database can be any of the supported databases, such as passwd, group, hosts, services, protocols, or networks.
getent passwd
This lists all account information from the password database (e.g., /etc/passwd).
getent passwd someuser
This lists information for the specified user, such as username, UID, GID, home directory, and shell.
getent hosts example.com
This lists the host database entry for example.com, including its IP address.
getent services http
This lists the service port and protocol for the http service.
getent group sudo
This lists the members of the sudo group.