If you are sitting in front of your Linux system, you can always open your browser and query Wikipedia for interesting topics. On the other hand, if you're logged in via a terminal emulator like PuTTY, or just prefer the command line, there's another option: wikit.

 There is a tool that queries Wikipedia from the command line and provides content summaries on a large collection of topics and that tool is wikit. It's easy to use and allows you to quickly query the rendered information and save it to a file if desired.

How to use the wiki

One thing Wikipedia doesn't tell us anything about, at least for now, is Wiki itself. So this post contains information about commands and how to use them or you can take help from the Wikipedia page creation agency so we can do it for you.

 

 For example, if we wanted to look up one of the many cities I lived in as a child, I could run a command like this:

$ wikit Rahway

Rahway is a city in southern Union County, New Jersey, United States. A bedroom

 community of New York City, it is centrally located in the Rahway Valley region,

 in the New York metropolitan area. The city is 21.6 miles southwest of Manhattan

 and 5 miles west of Staten Island. Built on the navigable Rahway River, it was

 an industrial and artisanal craft city for much of its history. The city has

 increasingly reinvented itself in recent years as a diverse regional hub for

 the arts. As of the 2010 United States Census, the city's population was 27,346,

 reflecting an increase of 846 (+3.2%) from the 26,500 counted in the 2000 Census,

 which had in turn increased by 1,175 (+4.6%) from the 25,325 counted in the

 1990 Census.

You can also save the returned text to a file like this:

$ wikit Rahway > Rahway

Wikit, which rhymes like "click it" or "ticket", pulls a summary from Wikipedia and, given an argument that matches multiple Wikipedia pages, returns a list of related topics. Down can use arrow keys. For example, if I request 911, the list starts with entries like the following, but progresses through a series of screens with additional topics:

$ wikit 911
? Ambiguous results, "911" may refer to: (Use arrow keys)
 AD 911
  911 BC
  September 11
  September 11 attacks
  11 de Septiembre
  November 9
  911 (number)
  9-1-1
  9-1-1 (Philippines)
  9/11: The Twin Towers
  9/11 (2002 film)
  9/11 (2017 film)
  Reno 911!: Miami
  Reno 911!
  9-11 (Noam Chomsky)

How to get the wiki

 wikit is not installed on Linux systems by default, but you can get it by following a few steps. You need to install both nodejs and npm first. Otherwise, you can install it using one of the following commands:

$ sudo dnf install nodejs npm
$ sudo apt install nodejs npm

Then install Wikit using an npm command like this:

$ sudo npm install wikit -g

you can also updated to the latest version of npm by running the following command after being prompted:

$ sudo npm install -g [email protected]

Get text from Wikipedia and use it

If you're querying a complex topic, be prepared for Wikit to return very long lines of text. For example, when I ask Wikipedia for information about astronomy, it says the following, even though the file is about 2,000 characters:

$ wikit astronomy > Astro
$ wc -l Astro
1 Astro

To split all these characters into multiple lines of maximum length 80, but only at word boundaries, we use the following command:

$ fold -s -w80 Astro > Astro2
$ wc -l Astro2
24 Astro2

-w80 specifies a maximum length of 80 and -s specifies to wrap on spaces.

 

 The original file had only 1 line, but the collapsed file has 24 lines.

$ wc -l Astro
1 Astro
$ wc -l Astro2
24 Astro2

Wikit does not require multi-word topics to be quoted, as shown in the following example.

$ wikit pecan pie
 Pecan pie is a pie of pecan nuts mixed with a filling of eggs, butter, and sugar
 (typically corn syrup). Variations may include white or brown sugar, cane syrup,
 sugar syrup, molasses, maple syrup, or honey. It is popularly served at holiday
 meals in the United States and is considered a specialty of Southern U.S. origin.
 Most pecan pie recipes include salt and vanilla as flavorings. Chocolate and
 bourbon whiskey are other popular additions to the recipe. Pecan pie is often
 served with whipped cream, vanilla ice cream, or hard sauce.

Of course, even Wikipedia doesn't tell you everything you want to know, but we do at Wikipedia page creation agency.

$ wikit pecan pie recipe
pecan pie recipe not found :^(

The language that Wikit uses is specified in the wikit file, and can be changed if you want topic summaries to appear in a different language.

$ cat .config/configstore/wikit.json
{
        "lang": "en"
}$

Changing 'en' to 'fr', my old hometown description looks like this:

$ wikit Rahway
 La ville de Rahway (en anglais ) est située dans le comté d’Union, dans l’État
 du New Jersey, aux États-Unis. Sa population s’élevait à 27346 habitants lors
 du recensement de 2010, estimée à 30131 habitants en 2017. Rahway fait partie
 du Grand New York.

Wrap up

Wikit provides an easy way to get text from Wikipedia from the command line and display it or save it to your Linux system.