dict - a perl client for accessing network dictionary servers


dict [OPTIONS] word


dict is a client for the Dictionary server protocol (DICT), which is used to query natural language dictionaries hosted on a remote machine. When used in the most simple way,

    % dict word

dict will look for definitions of word in the dictionaries hosted at If no definitions are found, then dict will look for words which are similar, and list them:

    % dict bonana
      no definition for "bonana" - perhaps you meant:
        banana, bonanza, Banana, Bonanza, Bonasa

This feature is only available if the remote DICT server supports the soundex or Levenshtein matching strategies. You can use the -stats switch to find out for yourself.

You can specify the hostname of the DICT server using the -h option:

    % dict -h dictionary

A DICT server can support a number of databases; you can use the -d option to specify a particular database. For example, you can look up computer-related terms in the Free On-line Dictionary Of Computing (FOLDOC) using:

    % dict -h -d foldoc byte

To find out what databases (dictionaries) are available on a server, use the -dbs option:

    % dict -dbs

There are many dictionaries hosted on other servers around the net; a list of some of them can be found at


Instead of requesting word definitions, you can use dict to request a list of words which match a pattern. For example, to look for four-letter words starting in 'b' and ending in 'p', you would use:

    % dict -match -strategy re '^b..p$'

The -match option says you want a list of matching words rather than a definition. The -strategy re says to use POSIX regular expressions when matching the pattern ^b..p$.

Most DICT servers support a number of matching strategies; you can get a list of the strategies provided by a server using the -strats switch:

    % dict -h -strats


-h server or -host server

The hostname for the DICT server. If one isn't specified then defaults to

-p port or -port port

Specify the port for connections (default is 2628, from RFC 2229).

-d dbname or -database dbname

The name of a specific database (dictionary) to query.

-m or -match

Look for words which match the pattern (using the specified strategy).

-i dbname or -info dbname

Request information on the specified database. Typically results in a couple of pages of text.

-c string or -client string

Specify the CLIENT identification string sent to the DICT server.

-D or -dbs

List the available databases (dictionaries) on the DICT server.

-s strategy or -strategy strategy

Specify a matching strategy. Used in combination with -match.

-S or -strats

List the matching strategies (used in -strategy) supported by the DICT server.

-I or -serverinfo

Request information on the selected DICT server.


Display a short help message including command-line options.


Display the full documentation for dict.


Display the version of dict


Display verbose information as dict runs.


Display debugging information as dict runs. Useful mainly for developers.


  • dict doesn't know how to handle firewalls.

  • The authentication aspects of RFC 2229 aren't currently supported.

  • Display of list results (eg from -strats and -dbs) could be better.

  • dict isn't very smart at handling combinations of options.

  • Currently no support for a configuration file - will add one soon.


The DICT home page, with all sorts of useful information. There are a number of other DICT clients available.


The C dict client written by Rik Faith; the options are pretty much lifted from Rik's client.

RFC 2229

The document which defines the DICT network protocol.


The perl module which implements the client API for RFC 2229.


$Revision: 1.2 $


Neil Bowers <>


Copyright (C) 2002 Neil Bowers. All rights reserved.

This script is free software; you can redistribute it and/or modify it under the same terms as Perl itself.