Wikit – Get Wikipedia Summaries From Commandline In Linux
Wikipedia has several millions of articles and the quantity of articles are steadily increasing every single day. It is the first place that comes to my mind when I’m looking for knowledge. Today, I have stumbled upon a simple, yet useful command-line utility called “Wikit”. It displays the summary of any Wikipedia article in Terminal. As we all know already, the Wikipedia has the largest and most comprehensive articles. If you don’t want to waste time to read a comprehensive Wikipedia article, you can then use Wikit to get Wikipedia summaries from commandline. To be precise, Wikit will display the first few paragraphs (the summary, of course) before the table of contents of a Wikipedia article.
First, you need to install NodeJS. Refer the following link to install NodeJS on your Linux system.
After NodeJS, run the following command from the Terminal as root or sudo user:
$ sudo npm install wikit -g
Wikit has been installed. Let us go ahead and see how to use it in real time.
How to use Wikit to get Wikipedia summaries from Commandline
The typical syntax of Wikit is:
$ wikit <query> <flags>
You can use the flags before or after the a query. And, the multi-word queries can be used without quotes.
Check the following example:
$ wikit linux
As you see in the above output, Wikit displays the summary of the Linux Wikipedia article.
Also, you can view summary in other languages as well. Say for the example, the following command displays the summary of specified wikipedia article in Spanish language.
$ wikit -lang es linux
For some languages, you should type the search terms in the native language fonts. For example, to display the summary of Linux wikipedia in Tamil language, you should use:
$ wikit -lang ta லினக்ஸ்
Don’t like to read in Terminal? You can open a specific Wikipedia article in your default web browser from commandline using the following command.
$ wikit linux -b
The above command opens the Linux wilipedia page in your default web browser. Here, we use -b flag to display full wikipedia article in browser.
Like I said already, you don’t need to specify multi-word queries within quotes.
$ wikit arch linux
As you may noticed in the above outputs, Wikit displays 80 characters per line. You can increase or decrease the maximum number of characters per line using -line parameter.
Say for example, to set line wrap length to 100 characters, use:
$ wikit -line 100 linux
To display all options, just run:
$ wikit Usage: $ wikit <query> [-flags] Quotes are not required for multi-word queries. Flags can be placed anywhere. Flags: -b Open Wikipedia article in browser -line <NUM> Set line wrap length to NUM (minimum 15) -lang <LANG> Specify language; -l <LANG> LANG is an HTML ISO language code -d Open disambiguation page in browser Examples: $ wikit nodejs $ wikit empire state building $ wikit linux -b $ wikit jugo -lang es
Hope this helps. If you find this guide helpful, please take a moment to share it on your social, professional networks and support OSTechNix. More good stuffs to come. Stay tuned!