LinuxCommandLibrary

sdcv

Look up word definitions using StarDict dictionaries

TLDR

Start sdcv interactively

$ sdcv
copy

List installed dictionaries
$ sdcv --list-dicts
copy

Display a definition from a specific dictionary
$ sdcv --use-dict [dictionary_name] [search_term]
copy

Look up a definition with a fuzzy search
$ sdcv [search_term]
copy

Look up a definition with an exact search
$ sdcv --exact-search [search_term]
copy

Look up a definition and format the output as JSON
$ sdcv --json [search_term]
copy

Search for dictionaries in a specific directory
$ sdcv --data-dir [path/to/directory] [search_term]
copy

SYNOPSIS

sdcv [OPTION...] [WORD...]
sdcv -l
sdcv -h

PARAMETERS

-h, --help
    Displays help information and exits.

-v, --version
    Displays version information and exits.

-l, --list-dictionaries
    Lists all available dictionaries and exits.

-u, --utf8-output
    Forces output to be in UTF-8 encoding. By default, encoding is derived from locale settings.

-j, --utf8-input
    Forces input to be in UTF-8 encoding. By default, encoding is derived from locale settings.

-x, --exact-search
    Performs an exact word search, not fuzzy.

-n, --numbered-output
    Prints search results with numbers, useful especially in interactive mode.

-c, --color
    Enables color output for search results, useful for readability.

-e, --example
    Searches with examples if the dictionary provides them (not universally supported by all dictionaries).

-s, --use-dict <DICT_NAME>
    Uses only dictionaries with the specified name(s). This option can be used multiple times to select several dictionaries.

-p, --data-path <PATH>
    Specifies an alternative path to the directory containing dictionary data files.

-i, --interactive
    Enters interactive mode, allowing continuous word lookups without re-running the command.

-a, --all-match
    Searches for all matching words, not just the first found entry.

--debug
    Prints debug information, primarily for developers.

--debug-search
    Prints detailed debug information specifically about the search process.

DESCRIPTION

sdcv is a free console dictionary client, based on the popular StarDict program. It enables users to quickly look up words and phrases directly from the command line, making it an ideal tool for developers, writers, and anyone who prefers a terminal-centric workflow.

sdcv utilizes StarDict dictionary files (typically .ifo, .idx, and .dz files) and can manage multiple dictionaries simultaneously. Its key features include exact word search, fuzzy search for potential misspellings, and an interactive mode for continuous lookups. It also supports piping input and output, allowing for seamless integration with other command-line tools and scripts. sdcv's lightweight nature combined with its powerful search capabilities makes it an efficient and indispensable utility for quick dictionary access in a command-line environment.

CAVEATS

sdcv relies on StarDict dictionary files (typically .ifo, .idx, .dz). These dictionaries must be installed in a standard location (e.g., /usr/share/stardict/dic or ~/.stardict/dic) or explicitly specified using the -p option. Without them, sdcv cannot perform any lookups. Its text-based interface means it lacks the graphical features of GUI dictionary applications.

DICTIONARY LOCATION

By default, sdcv looks for StarDict dictionaries in common system-wide paths like /usr/share/stardict/dic and user-specific paths such as ~/.stardict/dic. Ensure your downloaded .ifo, .idx, and .dz files for each dictionary are placed within a subdirectory under one of these locations, or specify a custom path using the -p option.

INTERACTIVE MODE USAGE

To use sdcv in interactive mode, simply run sdcv -i. You will then be prompted to enter words continuously. Type your word and press Enter to see its definition. To exit interactive mode, press Ctrl+D or type 'q' followed by Enter.

PIPING INPUT

sdcv can accept input from other commands via pipes. For example, to quickly look up a word found by another command, you can use: echo "word_to_lookup" | sdcv. This is particularly useful for scripting or integrating with other text processing tools.

HISTORY

sdcv emerged as the command-line counterpart to the popular open-source StarDict dictionary application, which gained significant traction in the early 2000s for its robust multi-dictionary support and extensible format. While StarDict provided a graphical user interface, sdcv filled the need for a lightweight, terminal-based solution. This allowed users to integrate dictionary lookups into shell scripts, automated tasks, or directly from within text editors and command-line environments, extending the utility of StarDict's vast dictionary collection beyond the desktop GUI.

SEE ALSO

stardict(1), grep(1), awk(1), sed(1)

Copied to clipboard