2

I'm wondering if there is any command to fetch the "introduction" (and perhaps the full article) of a Wikipedia entry on a terminal.

I found this article and a lot of article redirecting to it, but unfortunately when running this in the console it gives:

$ dig +short txt fooba.wp.dg.cx
$

It exits with code 0 so no error, but it doesn't show anything either.

Are there any Wikipedia query commands for Linux. I use lynx to browse the Internet, but sometimes you simply want to fetch the introduction fast and do some processing on it.

Serge Stroobandt
  • 5,719
  • 1
  • 54
  • 59

2 Answers2

4

Well, looking around:

$ apt search wikipedia              
Sorting... Done
Full Text Search... Done
libwww-wikipedia-perl/trusty 2.00-1 all
  perl module that provides an automated interface to Wikipedia

wikipedia2text/trusty,now 0.11-3 all [installed]
  displays Wikipedia articles on the command line

wikipediafs/trusty 0.4-5 all
  View and edit Wikipedia articles as if they were real files

Looking at the manpage of wikepedia2text:

-s        Display only the summary of the Wikipedia article.

-S        Display the full content of the  Wikipedia  article  and  not
          only the summary.

Testing it out:

$ wikipedia2text -s Linux
Changes must be reviewed before being displayed on this page.show/hide details
This is the latest accepted revision, reviewed on 17 September 2015.
Jump to: navigation, search
This article is about the operating system. For the kernel (also often referred
to as just "Linux"), used in all variants of the Linux operating system, see
Linux kernel. For other uses, see Linux (disambiguation).

                                     Linux
Tux the penguin
Tux the penguin, mascot of Linux^
Developer Community
 Written  Primarily C and assembly
   in
OS family Unix-like
 Working  Current
  state
 Source   Mainly open source, proprietary software also available


$ wikipedia2text Linux   
Page protected with pending changes level 1

Linux

From Wikipedia, the free encyclopedia
Changes must be reviewed before being displayed on this page.show/hide details
This is the latest accepted revision, reviewed on 17 September 2015.
Jump to: navigation, search
This article is about the operating system. For the kernel (also often referred
to as just "Linux"), used in all variants of the Linux operating system, see
Linux kernel. For other uses, see Linux (disambiguation).

                                     Linux
Tux the penguin
Tux the penguin, mascot of Linux^
Developer Community
 Written  Primarily C and assembly
   in
OS family Unix-like
 Working  Current
  state
 Source   Mainly open source, proprietary software also available
  model
 Initial  1991; 24 years ago (1991)
 release
Marketing Personal computers, mobile devices, embedded devices, servers,
 target   mainframes, supercomputers
Available Multilingual
   in
          Alpha, ARC, ARM, AVR32, Blackfin, C6x, ETRAX CRIS, FR-V, H8/300,
Platforms Hexagon, Itanium, M32R, m68k, META, Microblaze, MIPS, MN103, Nios II,
          OpenRISC, PA-RISC, PowerPC, s390, S+core, SuperH, SPARC, TILE64,
          Unicore32, x86, Xtensa
 Kernel   Monolithic (Linux kernel)
  type
Userland  Various
Default
  user    Many
interface
 License  GPLv2^ and other free and open-source licenses, except for the
          "Linux" trademark^[a]

...
muru
  • 207,228
0

Its possible to download wikipedia articles via their gopherized versions.

Here is an example pulling the article on sed:

lynx -dump gopher://gopherpedia.com/0/sed | less -  

Also if the article needs to be searched for go to the main page:

lynx gopher://gopherpedia.com/1

Or directly to the search:

lynx gopher://gopherpedia.com/7/lookup 
DC Slagel
  • 109