Fedora - Set up an offline command line dictionary in Fedora - Printable Version +- Sick Gaming (https://www.sickgaming.net) +-- Forum: Computers (https://www.sickgaming.net/forum-86.html) +--- Forum: Linux, FreeBSD, and Unix types (https://www.sickgaming.net/forum-88.html) +--- Thread: Fedora - Set up an offline command line dictionary in Fedora (/thread-93271.html) |
Fedora - Set up an offline command line dictionary in Fedora - xSicKxBot - 01-23-2020 Set up an offline command line dictionary in Fedora <div><p>You don’t need an internet connection to have an easily searchable and extendable dictionary on your Fedora computer. You can use <em>sdcv</em> (StarDict under Console Version) and the public Stardict files on the default repositories to keep a local record for offline use. This article shows you how.</p> <p> <span id="more-29917"></span> </p> <h2 id="what-is-sdcv">What is sdcv?</h2> <p>sdcv is a command line variant of Stardict. Stardict is a part of a long legacy of GUI offline dictionaries. The “dic” files it uses are formatted as a colon delimited file, with the word in first column and the definition in the second column. You can have multiple lines with the same word and different definitions. <em>sdcv</em> will provide you with a search function and formatted display of your results.</p> <h2 id="installing-sdcv">Installing sdcv</h2> <p>You can get started quickly with <em>sdcv</em> and the English dictionary by installing them from the default repos:</p> <pre class="wp-block-preformatted">sudo dnf install sdcv stardict-dic-en</pre> <p><em>sdcv</em> will be ready for use right away. If you want to see what other languages are available, use this command:</p> <pre class="wp-block-preformatted">dnf search stardict</pre> <h2 id="how-to-use-sdcv">How to use sdcv</h2> <p><em>sdcv</em> has an interactive and non-interactive mode. You can perform a quick search on a word or term using this command:</p> <pre class="wp-block-preformatted">sdcv <em>word</em></pre> <p>For example, you could search <em>sdcv linux</em>. Alternately, you can run <em>sdcv</em> by itself to activate interactive mode.</p> <h2 id="customizing-sdcv">Customizing sdcv</h2> <p><em>sdcv</em> has a <em>–color</em> option that adds coloring to the words and source of the definition. You can also use an alias to enable <em>–color</em> by default. Simply edit your <a href="https://fedoramagazine.org/manage-your-shell-environment/">shell resource file</a> (default on Fedora is <em>~/.bashrc</em>) to add this command:</p> <pre class="wp-block-preformatted">alias sdcv="sdcv --color"</pre> <p>You can also use a more friendly name like this: </p> <pre class="wp-block-preformatted">alias describe="sdcv --color"</pre> <p><em>sdcv</em> references <em>/usr/share/stardic/dic</em> by default, or it uses the path located in the shell variable <em>STARDICT_DATA_DIR</em>. You can also set up a personal dictionary in the file <em>$HOME/.stardict/dic</em>.</p> <h2>Fun facts</h2> <p>Believe it or not, the <a href="https://tools.ietf.org/html/rfc2229">dict network protocol</a> is still alive to this day. You can use it with the <em>curl</em> command by using a command like this to search for a word:</p> <pre class="wp-block-preformatted">curl dict://dict.org/d:<word></pre> <p>This pull definitions straight from the internet via your command line. Enjoy using <em>sdcv</em>!</p> <hr class="wp-block-separator" /> <p><em>Photo by <a href="https://unsplash.com/@pisitheng?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Pisit Heng</a> on <a href="https://unsplash.com/s/photos/dictionary?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText">Unsplash</a>.</em></p> </div> https://www.sickgaming.net/blog/2020/01/22/set-up-an-offline-command-line-dictionary-in-fedora/ |