{"id":5822,"date":"2018-07-30T20:20:42","date_gmt":"2018-07-30T16:20:42","guid":{"rendered":"https:\/\/www.howtoforge.com\/linux-aspell-command\/"},"modified":"2018-07-30T20:20:42","modified_gmt":"2018-07-30T16:20:42","slug":"linux-aspell-command-tutorial-for-beginners-5-examples","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/linux-aspell-command-tutorial-for-beginners-5-examples\/","title":{"rendered":"Linux aspell Command Tutorial for Beginners (5 Examples)"},"content":{"rendered":"<p>A spell checker is an important tool if your work involves writing or editing text files or documents. While most GUI based editors come with spell checking feature inbuilt, the same cannot be said for command line editors. However, there are separate command line tools that can help you with spell check.<\/p>\n<p>Here, in this tutorial, we will discuss one such utility, dubbed <strong>aspell<\/strong>. But before we dive in, it&#8217;s worth\u00a0mentioning that all examples in the article have been tested on an Ubuntu 18.04 LTS machine.<\/p>\n<h2 id=\"linux-aspell-command\">Linux aspell command<\/h2>\n<p>As already mentioned in the beginning, the aspell command lets you perform spell check on a text file. You can even check for individual words as well. Following is its syntax:<\/p>\n<p class=\"command\"><b>aspell<\/b> <i>[options] &lt;command&gt;<\/i><\/p>\n<p>And here&#8217;s what the man page says about this tool:<\/p>\n<pre readability=\"10\"> aspell is a utility program that connects to the Aspell library so that<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 it can function as an ispell -a replacement, as\u00a0 an\u00a0 independent\u00a0 spell<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 checker,\u00a0 as a test utility to test out Aspell library features, and as<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 a utility for managing dictionaries used by the library.<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The Aspell library contains an interface allowing other programs direct<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 access\u00a0 to\u00a0 its\u00a0 functions\u00a0 and\u00a0 therefore reducing the complex task of<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 spell checking to simple library calls.\u00a0 The default library\u00a0 does\u00a0 not<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 contain\u00a0 dictionary\u00a0 word\u00a0 lists.\u00a0 To add language dictionaries, please<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 check your distro first for modified dictionaries, otherwise look\u00a0 here<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 for base language dictionaries &lt;http:\/\/aspell.net&gt;.<\/p><\/pre>\n<p>Following are some Q&amp;A-styled examples that should give you a better idea on how the utility works.<\/p>\n<h2 id=\"q-how-to-use-the-aspell-command\">Q1. How to use the aspell command?<\/h2>\n<p>The basic usage of aspell isn&#8217;t completely straight forward, so it&#8217;s good to get a usage summary, something which you can get using the &#8216;usage&#8217; command option.<\/p>\n<p class=\"command\">aspell usage<\/p>\n<p>And here&#8217;s what you&#8217;ll likely get in output:<\/p>\n<pre>Usage: aspell [options] &lt;command&gt;<br\/>&lt;command&gt; is one of:<br\/>\u00a0 -?|usage\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display a brief usage message<br\/>\u00a0 help\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 display a detailed help message<br\/>\u00a0 -c|check &lt;file&gt;\u00a0 to check a file<br\/>\u00a0 -a|pipe\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 \"ispell -a\" compatibility mode<br\/>\u00a0 [dump] config\u00a0\u00a0\u00a0 dumps the current configuration to stdout<br\/>\u00a0 config &lt;key&gt;\u00a0\u00a0\u00a0\u00a0 prints the current value of an option<br\/>\u00a0 [dump] dicts | filters | modes<br\/>\u00a0\u00a0\u00a0 lists available dictionaries \/ filters \/ filter modes<br\/>[options] is any of the following:<br\/>\u00a0 --encoding=&lt;str&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 encoding to expect data to be in<br\/>\u00a0 --mode=&lt;str&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 filter mode<br\/>\u00a0 -l,--lang=&lt;str&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 language code<br\/>\u00a0 -d,--master=&lt;str&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 base name of the main dictionary to use<br\/>\u00a0 --sug-mode=&lt;str&gt;\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 suggestion mode<\/pre>\n<h2 id=\"q-how-to-check-a-file-for-spelling-errors-with-aspell\">Q2. How to check a file for spelling errors with aspell?<\/h2>\n<p>This can be done using the -c command line option. For example:<\/p>\n<p class=\"command\">aspell -c test.txt<\/p>\n<p>Following is what the tool displayed upon executing the above command:<\/p>\n<p><a class=\"fancybox\" id=\"img-aspell-basic-usage\" href=\"https:\/\/www.howtoforge.com\/images\/command-tutorial\/big\/aspell-basic-usage.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples.png\" alt=\"How to check a file for spelling errors with aspell\" width=\"500\" height=\"208\" title=\"\"><\/a><\/p>\n<p>So you can see the tool highlighted the first spelling mistake in the text, and in the lower half of the window, offered options that it thought I&#8217;d be interested in as replacement. Also, if you see closely, there are also options to ignore the currently highlighted spelling mistake, replace all occurances of the word currently highlighted, add to aspell&#8217;s dictionary, and exit from this view.<\/p>\n<h2 id=\"q-how-to-use-aspell-to-check-individual-words\">Q3. How to use aspell to check individual words?<\/h2>\n<p>This you can do using the -a command line option.<\/p>\n<p class=\"command\">aspell -a<\/p>\n<p>As soon as you run this command, it will wait for user input. Type a word in this mode, press enter, and you&#8217;ll see aspell offering spelling suggestions on stdout.<\/p>\n<p>The following screenshot shows this command line option in action:<\/p>\n<p><a class=\"fancybox\" id=\"img-aspell-a\" href=\"https:\/\/www.howtoforge.com\/images\/command-tutorial\/big\/aspell-a.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples-1.png\" alt=\"How to use aspell to check individual words\" width=\"500\" height=\"91\" title=\"\"><\/a><\/p>\n<h2 id=\"q-how-to-use-aspell-to-check-words-in-bulk\">Q4. How to use aspell to check words in bulk?<\/h2>\n<p>This you can do using the &#8216;list&#8217; command option.<\/p>\n<p class=\"command\">aspell list<\/p>\n<p>The above command, when run, will wait for user input. Add as many words as you want, and when done, press Ctrl+D. Then you&#8217;ll see that aspell will display incorrectly spelled words below the input you provided.<\/p>\n<p>Following screenshot shows this option in action:<\/p>\n<p><a class=\"fancybox\" id=\"img-aspell-list\" href=\"https:\/\/www.howtoforge.com\/images\/command-tutorial\/big\/aspell-list.png\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples-2.png\" alt=\"How to use aspell to check words in bulk\" width=\"374\" height=\"133\" title=\"\"><\/a><\/p>\n<h2 id=\"q-how-to-control-dictionary-used-by-aspell\">Q5. How to control dictionary used by aspell?<\/h2>\n<p>The man page for aspell offers various options that you can use to control the\u00a0dictionary used by this command. Here are some of the important ones:<\/p>\n<pre readability=\"26\"> --master=&lt;name&gt;, -d &lt;name&gt;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Base name of the dictionary to use.\u00a0 If this option is specified<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 then Aspell will either use this dictionary or die.<p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 --dict-dir=&lt;directory&gt;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Location of the main dictionary word list.<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 --lang=&lt;string&gt;, -l &lt;string&gt;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 Language to use.\u00a0 It follows the same format of the\u00a0 LANG\u00a0 envi?<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ronmental variable on most systems.\u00a0 It consists of the two let?<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 ter ISO 639 language code and an optional two\u00a0 letter\u00a0 ISO\u00a0 3166<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 country\u00a0 code\u00a0 after a dash or underscore.\u00a0 The default value is<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 based on the value of the LC_MESSAGES locale.<\/p><p>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 --size=&lt;string&gt;<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 The preferred size of the dictionary word list.\u00a0\u00a0 This\u00a0 consists<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 of\u00a0 a\u00a0 two char digit code describing the size of the list, with<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 typical values of: 10=tiny, 20=really small,\u00a0 30=small,\u00a0 40=med-<br\/>\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 small, 50=med, 60=med-large, 70=large, 80=huge, 90=insane.<\/p><\/pre>\n<h2 id=\"conclusion\">Conclusion<\/h2>\n<p>You&#8217;ll likely agree that aspell is a useful tool that Linux command line users should be aware of. We&#8217;ve discussed the basics of this tool here. Once you have practiced these options, head to the command&#8217;s\u00a0<a href=\"https:\/\/linux.die.net\/man\/1\/aspell\" target=\"_blank\" rel=\"noopener noreferrer\">man page<\/a> to learn more about it.<\/p>\n<div>\n<p><b>Share this page:<\/b><\/p>\n<p>\n<a href=\"https:\/\/www.facebook.com\/sharer.php?u=https%3A%2F%2Fwww.howtoforge.com%2Flinux-aspell-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples-3.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-aspell-command%2F&amp;text=Linux+aspell+Command+Tutorial+for+Beginners+%285+Examples%29&amp;via=howtoforgecom&amp;related=howtoforgecom\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples-4.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/twitter.com\/howtoforgecom\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples-5.png\" height=\"20\" alt=\"\" title=\"\"><\/a><br \/>\n<a href=\"https:\/\/plus.google.com\/share?url=https%3A%2F%2Fwww.howtoforge.com%2Flinux-aspell-command%2F\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img decoding=\"async\" src=\"https:\/\/afaghhosting.net\/blog\/wp-content\/uploads\/2018\/07\/linux-aspell-command-tutorial-for-beginners-5-examples-6.png\" height=\"20\" alt=\"\" title=\"\"><\/a>\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>A spell checker is an important tool if your work involves writing or editing text files or documents. While most GUI based editors come with spell checking feature inbuilt, the same cannot be said for command line editors. However, there are separate command line tools that can help you with spell check. Here, in this [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"class_list":["post-5822","post","type-post","status-publish","format-standard","hentry","category-36"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/5822","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=5822"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/5822\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=5822"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=5822"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=5822"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}