ldapwhoami
Check current user
ldapwhoami -vvv -H ldap://ldap.example.com
or on macOS
ldapwhoami -vvv -h ldap.example.com
Specify LDAP URI instead of host name
ldapwhoami -vvv -H ldap://ldap.example.com
Specify username and prompt for password
ldapwhoami -vvv -H ldap://ldap.example.com -U <USER> -W
ldapsearch
Query LDAP for given user name
ldapsearch -LLL -H ldap://ldap.example.com -b "DC=example,DC=com" "samAccountName=<USER>"
Specify attributes to display
ldapsearch -LLL -H ldap://ldap.example.com -b "DC=example,DC=com" "samAccountName=<USER>" dn sAMAccountName mail