GNU Dictionary Server
7.2 Interactive Mode
If neither word nor URL nor any operation mode option were
given on the command line,
dico enters interactive mode. In
this mode it reads commands from the standard input, executes them and
displays results on the standard output. If the standard input is
connected to a terminal, the readline and history facilities are
enabled (see Command Line Editing in GNU Readline Library).
When in interactive mode,
dico displays its prompt and
waits for you to enter a command. The default prompt is the name
of the program, followed by a ‘greater than’ sign and a single
The input syntax is designed so as to save you the maximum amount of typing.
If you type any word, the default action is to look up its definition using the default server and database settings, for example:
dico> man From eng-swa, English-Swahili xFried/FreeDict Dictionary: man <n.> mwanamume
To match the word, instead of defining it, prefix it with a slash,
much as you do in
dico> /man From eng-swa, English-Swahili xFried/FreeDict Dictionary: 0) ``can'' 1) ``man'' 2) ``many'' 3) ``map'' 4) ``may'' 5) ``men''
Displayed is a list of matches retrieved using the default strategy. To see a definition for a particular match, type the number shown at its left. For example, to define “men”:
dico> 5 From eng-swa, English-Swahili xFried/FreeDict Dictionary: men <n.> wanaume
Define and match are two basic actions. To discern from them, the
dico commands begin with a command prefix, a
single punctuation character selected for this purpose. The default
command prefix is a dot, but it can be changed using the
command (see prefix).
We will discuss the
dico commands in the following
7.2.1 Server Commands
open command establishes connection to a remote
server. It takes up to two arguments, first of them specifying
the IP or host name of the server, and the optional second one
specifying the port number to connect to. For example:
dico> .open gnu.org.ua
If any or both of its arguments are absent, the
reuses the value supplied with its previous invocation, or, if it is
issued for the first time, the default values. The default for server
name is ‘gnu.org.ua’ and the default port number is 2628. Both
values can be changed at configuration time, see Default Server
for a detailed instruction.
When given one argument,
open checks if it begins with a
directory separator (‘/’). If so, the argument is handled as the
full file name of a UNIX socket.
Note that you are not required to issue this command. If it is not
dico will attempt to establish a connection using its
default settings before executing any command that requires a
connection to the server.
close command closes the connection. It does not take
7.2.2 Database and Strategy
database command changes or displays the database name which
is used by define and match commands. To display the database name,
type the command without arguments:
dico> .database !
To change the database, give its name as an argument to the command:
dico> .database *
Once the connection with the server is established, you may use command line completion facility to select the database from among those offered by the server. Typing TAB will show you a list of databases that begin with the characters you typed:
dico> .database enTAB en-pl-naut eng-afr eng-deu eng-swa
If you supply enough characters to identify a single choice, TAB will automatically select it. In the example above, typing a TAB after
dico> .database en-
completes the database name to:
dico> .database en-pl-naut
strategy command displays or changes the default strategy
name. As with
database, the strategy completion is available
for this command.
dico> .strategy . dico> .strategy dlev
If the remote server supports ‘xlev’ experimental capability
(see XLEV), you can use the
to set the maximum Levenshtein distance for strategies that use
Levenshtein algorithm. If used without arguments, this command
displays the distance reported by the server and the configured
dico> .distance Reported Levenshtein distance: 1 No distance configured
If used with a single numeric argument, it attempts to set the distance to the supplied value.
7.2.3 Informational Commands
ls command lists available strategies (see SHOW
dico> .ls exact "Match words exactly" prefix "Match word prefixes" soundex "Match using SOUNDEX algorithm" all "Match everything (experimental)" lev "Match headwords within given Levenshtein distance" dlev "Match headwords within given Damerau-Levenshtein distance" re "POSIX 1003.2 (modern) regular expressions" regexp "Old (basic) regular expressions" suffix "Match word suffixes" rev-qu "Reverse search in Quechua databases"
ld command lists available databases (see SHOW
dico> .ld eng-swa "English-Swahili xFried/FreeDict Dictionary" swa-eng "Swahili-English xFried/FreeDict Dictionary" afr-eng "Afrikaans-English FreeDict Dictionary" eng-afr "English-Afrikaans FreeDict Dictionary"
info command displays information about a database, whose
name is given as its argument. If used without arguments, it displays
information about the current database.
dico> .info pl-en-naut pl-en-naut - A Polish-English dictionary of nautical terms. Copyright (C) 2008 Sergey Poznyakoff Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover and Back-Cover Texts.
7.2.4 History Commands
Each issued command is stored in a history list and assigned a
unique event number. When
dico exits, it saves the
command history to a file named .dico_history in your home
directory. Upon startup, it retrieves the history from this file, so
the history is preserved between sessions.
You can view the command history using the
dico> .history 1) .open dict.org 2) entdeckung 3) /geschwindigkeit
A number of editing commands is provided, that allow you to refer to
previous events from the history list and to edit them. For example,
to re-issue the 3rd event from the above list, type ‘!3’. The
command with this index will be inserted at the
and you will be given a possibility to edit it. For a detailed
description of all history-editing commands, please refer to
Using History Interactively in GNU History User Manual.
When a command produces output that contains more lines than
there are rows on the terminal,
dico attempts to use a
pager program to display it. The name (and arguments) of
the pager program are taken from the
dico internal variable,
or, if it is not set, from the
PAGER environment variable.
dico pager setting can be examined or changed using
pager command. When used without arguments, it displays
the current setting:
dico> .pager less (Pager set from environment)
When used with a single argument, it sets the pager:
dico> .pager "less -R"
The argument ‘-’ (a dash) disables pager.
7.2.6 Program Settings
The commands described in this subsection are designed mostly for
dico initialization file (see Initialization File).
autologin command sets the name of autologin file to
be used for authentication. When used without arguments, it displays
the current setting. The argument to
autologin command is
subject to tilde expansion, i.e. if it begins with ‘~/’,
this prefix is replaced with the name of the current user home
directory, followed by ‘/’. Similarly, a prefix
‘~login/’ is replaced by the home directory for user
login, followed by a slash.
See Autologin, for a detailed discussion of the autologin feature.
quiet command toggles the display of
startup banner. When started,
dico prints a short list
of information useful for beginning users: the program version and
warranty conditions and a command to get help, e.g.:
dico 2.9 Copyright (C) 2005-2016 Sergey Poznyakoff License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type ? for help summary dico>
If you find this output superfluous and useless, you can suppress it by setting
in your initialization file.
7.2.7 Session Transcript
Session transcript is a special mode, which displays raw DICT commands and answers as they are executed. It is useful for debugging purposes.
You enable session transcript by issuing the following command:
dico> .transcript yes # or dico> .transcript on
Starting from then, each DICT transaction will be displayed on standard error output, for example:
dico> .open dico: Debug: S:220 Pirx.gnu.org.ua dicod (dico 2.9) <mime.xversion.xlev> <email@example.com> dico: Debug: C:CLIENT "dico 1.99.91" dico: Debug: S:250 ok dico: Debug: C:SHOW DATABASES dico: Debug: S:110 26 databases present … dico: Debug: S:. dico: Debug: S:250 ok dico: Debug: C:SHOW STRATEGIES dico: Debug: S:111 10 strategies present: list follows dico: Debug: S:exact "Match words exactly" dico: Debug: S:prefix "Match word prefixes" dico: Debug: S:soundex "Match using SOUNDEX algorithm" … dico: Debug: S:. dico: Debug: S:250 ok
In the example above, ellipses are used to replace long lists of data. As you see, session transcripts may produce large amount of output.
To turn the session transcript off, use the following command:
dico> .transcript no # or dico> .transcript off
Finally, to query the current state of session transcript, issue this command without arguments:
dico> .transcript transcript is on
7.2.8 Other Commands
prefix command queries or changes the current command prefix:
dico> .prefix Command prefix is . dico> .prefix @ dico> @prefix Command prefix is @
prompt command changes the
dico command line
prompt. For example, to change it to ‘dico$’, followed by a single
dico> .prompt "dico$ " dico$ _
Note the use of quotes to include the space character in the argument.
help command displays a short command usage summary. For
convenience, a single question mark can be used instead of it:
dico> ? /WORD Match WORD. / Redisplay previous matches. NUMBER Define NUMBERth match. !NUMBER Edit NUMBERth previous command. .open [HOST [PORT]] Connect to a DICT server. .close Close the connection. …
version command displays the package name and version
number, and the
warranty command displays the copyright
quit command leaves the dico shell. Typing
end-of-file character (C-d) has the same effect.
7.2.9 Dico Command Summary
For convenience, this subsection lists all available
commands along with their short description and a reference to the
part of this manual where they are described in detail. The command
names are given without prefix.
open host port
Connect to a DICT server. Both arguments are optional. If any of them is absent, the value supplied with the previous
opencommand is used. If there was no previous value, the default is used, i.e., ‘gnu.org.ua’ for host, and 2628 for port.
Close the connection.
Set or display the autologin file name.
Without argument, show whether the SASL authentication is enabled. With argument, enable or disable it, depending on the value of bool. See Autologin.
Set or display the current database name.
Set or display the current strategy name.
Set or query Levenshtein distance. This command takes effect only if the remote server supports ‘xlev’ experimental capability (see XLEV).
List available matching strategies.
List all accessible databases.
Display information about the database db, or the current database, if used without argument.
Set or display the command prefix.
Set or display session transcript mode.
See Session Transcript.
Set or display debugging verbosity level. Currently (as of version 2.9) it is a no-op.
Change command line prompt.
Change or display pager settings.
Display command history.
See History Commands.
Display short command usage summary.
Print program version.
Print copyright statement.
Toggle display of
dicowelcome banner. This command can be used only in initialization file.
Quit the shell.
This document was generated on April 24, 2019 using makeinfo.Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.