ldapsearch

ldapsearch

The ldapsearch command is used to query the directory for a specific entry from the command line, and to display the attributes of an entry once located. A query string composed of a logical condition is passed on the command line, along with a set of attributes that are to be displayed. For example, to search for the common name "Paul Watters" and display the results, the following command would be used:

$ ldapsearch -u "cn=Paul Watters" cn
cn=Paul A Watters, ou=Engineering, o=cassowary.net, c=US
cn=Paul Watters

Alternatively, if the UID of the user you were searching for was known and you wanted to look up the common name, the following command could be used:

$ ldapsearch -u -t "uid=paul" cn
cn=Paul A Watters, ou=Engineering, o=cassowary.net, c=US
cn=Paul Watters

It's possible to perform a wider area search than just looking for a single individual. For example, to print a description of all organizations lying below the country 'US' in the DIT, the following command would be used:

$ ldapsearch -L -b "c=US" description
dn: o=cassowary.net, c=US
description: Cassowary Computing Pty Ltd


Part I: Solaris 9 Operating Environment, Exam I