---
name: "lbdbq"
section: "1"
platform: "linux"
package: "lbdb"
version: "0.56-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/lbdbq"
---

# lbdbq(1)

query program for the little brother's database

## NAME

lbdbq - query program for the little brother's database

## SYNOPSIS

**lbdbq** *something*\
 **lbdbq** \[**-v**\|**--version**\|**-h**\|**--help**\]

## DESCRIPTION

**lbdbq** is the client program for the little brother's database. It will attempt to invoke various modules to gather information about persons matching *something*. E.g., it may look at a list of addresses from which you have received mail, it may look at YP maps, or it may try to finger *something*@*\<various hosts\>*.

The behavior is configurable: Upon startup, **lbdbq** will source the shell scripts:

*/etc/lbdb.rc*\
 *$XDG\_CONFIG\_HOME/lbdb/config*\
 *$HOME/.lbdbrc*\
 *$HOME/.lbdb/lbdbrc*\
 *$HOME/.lbdb/rc*

if they exist.

They can be used to set the following global variables:

- **MODULES\_PATH**

  a space separated list of directories, where **lbdbq** should look for modules.

- **METHODS**

  a space separated list of the modules to use.

- **SORT\_OUTPUT**

  If you set this to *false* or *no*, lbdbq won't sort the addresses but returns them in reverse order (which means that the most recent address in m\_inmail database is first). If you set this to *name*, lbdbq sorts the output by real name.  If you set this to *comment*, it sort the output by the comment (for example the date in **m\_inmail**). *reverse\_comment* realizes the same as *comment*, but in reverse order, so the most recent timestamp of m\_inmail may be on top. If you set SORT\_OUTPUT to *address*, lbdbq sorts the output by addresses (that's the default).

- **KEEP\_DUPES**

  If you set this to *true* or *yes*, lbdbq won't remove duplicate addresses with different real name comment fields.

Note that there *are* defaults, so you should most probably modify these variables using constructs like this:

```
       MODULES_PATH="$MODULES_PATH $HOME/lbdb_modules"
```

Additionally, modules may have configuration variables of their own.

## MODULES

Currently, the following modules are supplied with lbdb:

- **m\_finger**

  This module will use finger to find out something more about a person. The list of hosts do be asked is configurable; use the **M\_FINGER\_HOSTS** variable. Note that "localhost" will mean an invocation of your local [**finger**(1)](/finger/1.md) binary, and should thus work even if you don't provide the finger service to the network. **m\_finger** tries to find out the machines mail domain name in */etc/mailname*, by parsing a *sendmail.cf* file (if it finds one) and by reading */etc/hostname* and */etc/HOSTNAME*. If you know that this fails on your machine, or you want to force lbdbq to consider some other name to be the local mail domain name (misconfigured SUNs come to mind here), you can specify a name using the **MAIL\_DOMAIN\_NAME** variable. If this variable is set by you, no probing will be done by **lbdbq**.

- **m\_inmail**

  This module will look up user name fragments in a list of mail addresses created by [**lbdb-fetchaddr**(1)](/lbdb-fetchaddr/1.md). By default this uses *$XDG\_DATA\_HOME/lbdb/m\_inmail.db*, which is overridden, if *$HOME/.lbdb/m\_inmail.utf-8* exists (the old default) as its database file, but this can be changed using **INMAIL\_DB** variable (but do not forget to change this in the [**lbdb-fetchaddr**(1)](/lbdb-fetchaddr/1.md) call using option -f, too).

- **m\_passwd**

  This module searches for matching entries in your local /etc/passwd file. It evaluates the local machine mail domain in the same way **m\_finger** does.  If you set **PASSWD\_IGNORESYS=true**, this module ignores all system accounts and only finds UIDs between 1000 and 29999 (all other UIDs are reserved on a Debian system).

- **m\_yppasswd**

  This module searches for matching entries in the NIS password database using the command \`\`ypcat passwd''.

- **m\_nispasswd**

  This module searches for matching entries in the NIS+ password database using the command \`\`niscat passwd.org\_dir''.

- **m\_getent**

  This module searches for matching entries in whatever password database is configured using the command \`\`getent passwd''.

- **m\_pgp2**, **m\_pgp5**, **m\_gpg**

  These modules scan your PGP 2.\*, PGP 5.\* or GnuPG public key ring for data. They use the programs **pgp**(1), **pgpk**(1), or [**gpg**(1)](/gpg/1.md) to get the data.

- **m\_fido**

  This module searches your Fido nodelist, stored in *$HOME/.lbdb/nodelist* created by [**nodelist2lbdb**(1)](/nodelist2lbdb/1.md).

- **m\_abook**

  This module uses the program [**abook**(1)](/abook/1.md), a text based address book application to search for addresses.  You can define multiple abook address books by setting the variable **ABOOK\_FILES** to a space separated list.

- **m\_goobook**

  This module uses the program [**goobook**(1)](/goobook/1.md), a tool to access Google contacts via command line.

- **m\_addr\_email**

  This module uses the program [**addr-email**(1)](/addr-email/1.md), a text based frontend to the Tk [**addressbook**(1)](/addressbook/1.md) application.

- **m\_muttalias**

  This module searches the variable **MUTTALIAS\_FILES** (a space separated list) of files in **MUTT\_DIRECTORY** that contain mutt aliases.  File names without leading slash will have **MUTT\_DIRECTORY** (defaults to **$HOME***/.mutt* or **$HOME**, if **$HOME***/.mutt* does not exist) prepended before the file name.  Absolute file names (beginning with */*) will be taken direct.

- **m\_pine**

  This module searches **pine**(1) addressbook files for aliases.  To realize this it first inspects the variable **PINERC**. If it isn't set, the default \`*/etc/pine.conf /etc/pine.conf.fixed .pinerc*' is used.  To suppress inspecting the **PINERC** variable, set it to *no*. It than takes all **address-book** and **global-address-book** entries from these pinerc files and adds the contents of the variable **PINE\_ADDRESSBOOKS** to the list, which defaults to \`*/etc/addressbook .addressbook*'. Then these addressbooks are searched for aliases.  All filenames without leading slash are searched in **$HOME**.

- **m\_palm**

  This module searches the Palm address database using the [**Palm::PDB**(3pm)](/Palm::PDB/3pm.md) and [**Palm::Address**(3pm)](/Palm::Address/3pm.md) Perl modules from CPAN. It searches in the variable **PALM\_ADDRESS\_DATABASE** or if this isn't set in *$HOME/.jpilot/AddressDB.pdb*.

- **m\_gnomecard**

  This module searches for addresses in your GnomeCard database files. The variable **GNOMECARD\_FILES** is a whitespace separated list of GnomeCard data files.  If this variable isn't defined, the module searches in **$HOME***/.gnome/GnomeCard* for the GnomeCard database or at least falls back to **$HOME***/.gnome/GnomeCard.gcrd.* If a filename does not start with a slash, it is prefixed with **$HOME/**.

- **m\_bbdb**

  This module searches for addresses in your (X)Emacs BBDB (big brother database).  It doesn't access ~/.bbdb directly (yet) but calls [**emacs**(1)](/emacs/1.md) or [**xemacs**(1)](/xemacs/1.md) with a special mode to get the information (so don't expect too much performance in this module).  You can configure the **EMACS** variable to tell this module which emacsen to use.  Otherwise it will fall back to **emacs** or **xemacs.**

- **m\_ldap**

  This module queries an LDAP server using the [**Net::LDAP**(3pm)](/Net::LDAP/3pm.md) Perl modules from CPAN.  It can be configured using an external resource file */etc/lbdb\_ldap.rc* or *$XDG\_CONFIG\_HOME/lbdb/ldap.rc* or *$HOME/.lbdb/ldap.rc* or *$HOME/.mutt\_ldap\_query.rc*. You can explicitly define a LDAP query in this file or you can use one or more of the predefined queries from the **%ldap\_server\_db** in this file.  For this you have to define a space separated list of nicknames from entries in the variable **LDAP\_NICKS**.

- **m\_wanderlust**

  This module searches for addresses stored in your *$WANDERLUST\_ADDRESSES* (or by default in *$HOME/.addresses*) file, an addressbook of **WanderLust**.

- **m\_osx\_addressbook**

  This module queries the OS X AddressBook.  It is only available on OS X systems.

- **m\_evolution**

  This module queries the Ximian Evolution address book.  It depends on the program **evolution-addressbook-export**, which is shipped with evolution.

- **m\_vcf**

  This module uses a bundled little perl program named vcquery to search for addresses from the space-separated set of vCard files defined in *$VCF\_FILES*.

- **m\_khard**

  This module searches a CardDAV address book via [**khard**(1)](/khard/1.md).

- **m\_mu**

  This module uses the program [**mu-cfind**(1)](/mu-cfind/1.md), which searches in the index file generated by the mu tool. You can filter the results with the variables **MU\_AFTER** (the number of seconds since 1970-01-01 UTC) and **MU\_PERSONAL** (set to *true* or *yes*, remember to invoke [**mu-index**(1)](/mu-index/1.md) with *--my-address*)

Feel free to create your own modules to query other database resources, YP maps, and the like. **m\_finger** should be a good example of how to do it.

If you create your own modules or have other changes and feel that they could be helpful for others, don't hesitate to submit them to the author for inclusion in later releases.

Finally, to use **lbdbq** from mutt, add the following line to your *$HOME/.muttrc:*

```
    set query_command="lbdbq %s"
```

## OPTIONS

- \-v \| --version

  Print version number of lbdbq.

- \-h \| --help

  Print short help of lbdbq.

## FILES

*/etc/lbdb.rc*\
 *$XDG\_CONFIG\_HOME/lbdb/config*\
 *$HOME/.lbdbrc*\
 *$HOME/.lbdb/lbdbrc*\
 *$HOME/.lbdb/rc*\
 */usr/libexec/lbdb/\**\
 *$XDG\_DATA\_HOME/lbdb/m\_inmail.db*\
 *$HOME/.lbdb/m\_inmail.utf-8*\
 *$HOME/.lbdb/nodelist*

## SEE ALSO

[**finger**(1)](/finger/1.md), [**ypcat**(1)](/ypcat/1.md), **niscat**(1), [**getent**(1)](/getent/1.md), **pgp**(1), **pgpk**(1), [**gpg**(1)](/gpg/1.md), [**lbdb-fetchaddr**(1)](/lbdb-fetchaddr/1.md), [**nodelist2lbdb**(1)](/nodelist2lbdb/1.md), [**mutt\_ldap\_query**(1)](/mutt_ldap_query/1.md), [**abook**(1)](/abook/1.md), [**goobook**(1)](/goobook/1.md), [**addr-email**(1)](/addr-email/1.md), [**addressbook**(1)](/addressbook/1.md), [**mutt**(1)](/mutt/1.md), **pine**(1), [**emacs**(1)](/emacs/1.md), [**xemacs**(1)](/xemacs/1.md), [**Palm::PDB**(3pm)](/Palm::PDB/3pm.md), [**Palm::Address**(3pm)](/Palm::Address/3pm.md), [**Net::LDAP**(3pm)](/Net::LDAP/3pm.md).

## CREDITS

Most of the really interesting code of this program (namely, the RFC 822 address parser used by lbdb-fetchaddr) was stolen from Michael Elkins' mutt mail user agent. Additional credits go to Brandon Long for putting the query functionality into mutt.

Many thanks to the authors of the several modules and extensions: Ross Campbell \<rcampbel@us.oracle.com\> (m\_abook, m\_yppasswd), Marc de Courville \<marc@courville.org\> (m\_ldap, mutt\_ldap\_query), Brendan Cully \<brendan@kublai.com\> (m\_osx\_addressbook, m\_vcf), Gabor Fleischer \<flocsy@mtesz.hu\> (m\_pine), Rick Frankel \<rick@rickster.com\> (m\_gnomecard), Utz-Uwe Haus \<haus@uuhaus.de\> (m\_bbdb, m\_nispasswd), Torsten Jerzembeck \<toje@nightingale.ms.sub.org\> (m\_addr\_email), Adrian Likins \<alikins@redhat.com\> (m\_getent), Gergely Nagy \<algernon@debian.org\> (m\_wanderlust), Dave Pearson \<davep@davep.org\> (m\_palm, lbdb.el), Brian Salter-Duke \<b\_duke@bigpond.net.au\> (m\_muttalias), François Charlier \<fcharlier@ploup.net\> (m\_goobook), and Colin Watson \<cjwatson@debian.org\> (m\_khard)

## AUTHOR

The lbdb package was initially written by Thomas Roessler \<roessler@guug.de\> and is now maintained and heavily extended by Roland Rosenfeld \<roland@spinnaker.de\>.
