CONFIGURING


Examples of using ldapsearch

The following examples us the ldapsearch utility.

About this task

Table 1. Examples of using the ldapsearch utility
SearchCommand
All entries on host ldap.renovations.com using port 389, and return all attributes and valuesldapsearch -h ldap.renovations.com "objectClass=*"
All entries on host ldap.renovations,com using port 389, and return attribute names onlyldapsearch -A -h ldap.renovations.com "objectClass=*"
All entries on host ldap.renovations.com using port 389, return all attributes, and de-reference any aliases foundldapsearch -a always -h ldap.renovations.com "objectClass=*"
All entries on host ldap.renovations.com using port 389, and return attributes=mail, cn, sn, givennameldapsearch -h ldap.renovations.com "objectClass=*" mail cn sn givenname
(cn=Mike*) under base "ou=West,o=Renovations, c=US" on host ldap.renovations.com using port 389, and return all attributes and valuesldapsearch -b "ou=West,o=Renovations,c=US" -h ldap.renovations.com "(cn=Mike*)"
One level on host ldap.renovations.com using port 389, and return all attributes and valuesldapsearch -s onelevel  -h ldap.renovations.com "objectClass=*"
One level on host ldap.renovations.com using port 389, and return all attributes and values, but with scope limited to baseldapsearch -s base -h ldap.renovations.com "objectClass=*"
All entries on host ldap.renovations.com using port 389; return all attributes and values; do not exceed the time limit of five secondsldapsearch -l 5 -h ldap.renovations.com "objectClass=*"
All entries on host ldap.renovations.com using port 389; return all attributes and values; do not exceed the size limit of fiveldapsearch -z 5 -h ldap.renovations.com "objectClass=*"
All entries on host ldap.renovations.com using port 389, binding as user "cn=John Doe,o=Renovations" with a password of "password", and return all attributes and values in LDIF formatldapsearch -h ldap.renovations.com -D "cn=john doe,o=renovations" -w password -L "objectClass=*"
Search the host ldap.renovations.com using port 389. All attributes that anonymous are allowed to see are returned for the entry "cn=John Doe,o=Renovations" ldapsearch -h ldap.renovations.com -s base -b "cn=john doe,o=renovations" "objectClass=*"

Related concepts
ldapsearch utility

Related tasks
Table of ldapsearch parameters
Using search filters with ldapsearch
Table of operators used in ldapsearch search filters
Using ldapsearch to return operational attributes