ldapsearch limit returned results

[problem]

You want to perform an ldap search but only receive a limited number of records in return.

[/problem]

[solution]

Use -z # to restrict the number of records returned.

[/solution]

[example]

Search and return only 5 records.


ldapsearch -x -z 5 -v-D"cn=Manager,dc=demo,dc=net"-w secret
-b"dc=demo,dc=net" "(lastlogin>=99999999)"

[/example]

[reference]

[tags], LDAP Training School[/tags]

[/reference]

ldapsearch greater than

[problem]

You want to search for a field greater than a value, in your LDAP search.

[/problem]

[solution]

To search for a field with a value greater than a given figure, we use >=. If you try to just use > it chucks out an error.

[/solution]

[example]

This is how to perform a greater than LDAP search.


ldapsearch -x -v-D"cn=Manager,dc=demo,dc=net"-w secret
-b"dc=demo,dc=net" "(lastlogin>=99999999)"

[/example]

[reference]

[tags]ldapsearch syntax, openldap ldapsearch, LDAP Training School[/tags]

[/reference]