Home Command line utilities Wikit – Get Wikipedia Summaries From Commandline In Linux
Display Wikipedia summaries from commandline using wikit

Wikit – Get Wikipedia Summaries From Commandline In Linux

By sk
108 Views

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 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.

Install Wikit on Linux

First, you need to install NodeJS. Refer the following link to install NodeJS on your Linux system.

After NodeJS is installed, run the following command as root or sudo user to install Wikit :

$ sudo npm install wikit -g

Wikit has been installed. Let us go ahead and see how to use it to display wikipedia summaries.

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
Get Wikipedia summaries from Commandline using wikit

Get Wikipedia summaries from Commandline using wikit

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
Get Wikipedia summaries in a specific language using wikit

Get Wikipedia summaries in a specific language using wikit

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.

Resource:

Thanks for stopping by!

Help us to help you:

Have a Good day!!

You May Also Like

1 comment

Larry Gagnon September 8, 2017 - 7:12 am

It’s not really necessary to install another package to do this. Here is the .bashrc function I use to get essentially the same facility:

# command line wikipedia lookup
wikid() {
links -dump “http://en.wikipedia.org/wiki/$1” | less
}

You can change “links” to whatever text-based browser your Linux/Unix system has on it.

Reply

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More