You must’ve noticed when working in a terminal, the command line is very picky about spelling. This can be irritating at the time being, but having the correct spelling is very vital in the command line.
Most office-suites have a spellchecker to help you along the line, wouldn’t it be wonderful if the terminal also had one?
Well there is and it’s called Aspell, it checks the spelling of a text you wrote in the terminal and this is the official description of it:
Aspell is a utility program that connects to the Aspell library so that it can function as an ispell -a replacement, as an independent spellchecker, as a test utility to test out Aspell library features, and as a utility for managing dictionaries used by the library. The Aspell library contains an interface allowing other programs direct access to its functions and therefore reducing the complex task of spell checking to simple library calls. The default library does not contain dictionary word lists.
The basic usage of aspell isn’t completely straight forward, so it’s good to get a usage summary, something which you can get using the ‘usage’ command option.
And the output looks like this:
Usage: aspell [options] <command><command> is one of: -?|usage display a brief usage message help display a detailed help message -c|check <file> to check a file -a|pipe "ispell -a" compatibility mode [dump] config dumps the current configuration to stdout config <key> prints the current value of an option [dump] dicts | filters | modes lists available dictionaries / filters / filter modes[options] is any of the following: --encoding=<str> encoding to expect data to be in --mode=<str> filter mode -l,--lang=<str> language code -d,--master=<str> base name of the main dictionary to use --sug-mode=<str> suggestion mode
You can check for spelling errors in a text you’ve created by using the next command:
aspell -c nameoftext.txt
You then noticed that the tool highlights the first spelling mistake in the text, and in the lower half of the window, offered options that it thought I’d be interested in as a replacement. Also, if you see closely, there are also options to ignore the currently highlighted spelling mistake, replace all occurrences of the word currently highlighted, add to aspell’s dictionary, and exit from this view.
Check for individual words
To let aspell check for individual words, you can use the -a command-line option.
As soon as you run this command, it will wait for user input. Type a word in this mode, press enter, and you’ll see aspell offering spelling suggestions on stdout.
To use aspell to check words in bulk you can use the list command option.
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’ll see that aspell will display incorrectly spelt words below the input you provided.
How to control the dictionary
The man page for aspell offers various options that you can use to control the dictionary used by this command. Here are some of the important ones:
--master=<name>, -d <name> Base name of the dictionary to use. If this option is specified then Aspell will either use this dictionary or die. --dict-dir=<directory> Location of the main dictionary word list. --lang=<string>, -l <string> Language to use. It follows the same format of the LANG envi? ronmental variable on most systems. It consists of the two let? ter ISO 639 language code and an optional two letter ISO 3166 country code after a dash or underscore. The default value is based on the value of the LC_MESSAGES locale. --size=<string> The preferred size of the dictionary word list. This consists of a two char digit code describing the size of the list, with typical values of: 10=tiny, 20=really small, 30=small, 40=med- small, 50=med, 60=med-large, 70=large, 80=huge, 90=insane.
You’ll likely agree that aspell is a useful tool that Linux command line users should be aware of.
The ar command allows you to create, modify, or extract archives. Following is its syntax:
ar [OPTIONS] archive_name member_files
And here’s what the man page says about this tool:
The GNU ar program creates, modifies, and extracts from archives. An archive is a single file holding a collection of other files in a structure that makes it possible to retrieve the original individual files (called members of the archive).The original files' contents, mode (permissions), timestamp, owner, and group are preserved in the archive, and can be restored on extraction.GNU ar can maintain archives whose members have names of any length; however, depending on how ar is configured on your system, a limit on member-name length may be imposed for compatibility with archive formats maintained with other tools. If it exists, the limit is often 15 characters (typical of formats related to a.out) or 16 characters (typical of formats related to coff).ar is considered a binary utility because archives of this sort are most often used as libraries holding commonly needed subroutines.ar creates an index to the symbols defined in relocatable object modules in the archive when you specify the modifiers. Once created, this index is updated in the archive whenever ar makes a change to its contents (save for the q update operation). An archive with such an index speeds up linking to the library, and allows routines in the library to call each other without regard to their placement in the archive.
Create an archive using ar
This you can do using the r command option, which according to the man page lets you “replace existing or insert new file(s) into the archive.”
So for example:
ar r test.a *.txt
The above command creates an archive ‘test.a’ that contains all the txt files from the current directory.
List contents of archive
This can be done using the ‘t’ command-line option. So for example, running the following command:
ar t test.a
Display contents of files included in archive
This can be done using the ‘p’ command option. Here’s an example:
ar p test.a
Add a new member to archive
The ‘r’ command option lets you do this as well. For example, to add a new text file – tes3.txt – to existing archive test. a, I used the following command:
ar r test.a test3.txt
Delete a member from archive
That’s easy as well. Just use the ‘d’ command option and specify the name of the member to delete.
For example, to delete test3.txt, I used the ar command in the following way:
ar d test.a test3.txt
The ar command is a handy little tool for when you want to create or edit archives. It’s also used in programming to create static libraries that programs link to.Follow us: