Search Wikipedia from Command Line

Tagged with: , , ,

Get the intro paragraph of any wikipedia article using this trick…

dig +short txt "<keyword>"

3 Responses to “Search Wikipedia from Command Line

  • 1
    Miriam English
    November 13th, 2014 06:53

    Hi Binny. This is a really interesting idea, but I couldn’t get it to work, always getting only the error message:
    ;; connection timed out; no servers could be reached”

    Could it be the address is incorrect? How did you come up with the address:

  • 2
    Binny V A
    November 14th, 2014 11:09

    Hmm. Yeah – it has stopped working for me too. Try the other options in this page…

  • 3
    Miriam English
    November 14th, 2014 13:24

    Thanks Binny.
    I’m not sure how it works, but it looks to me like the script that serves this has stopped. More can be read about it here:

    I have a rather clumsy substitute:
    lynx -dump ‘’ | head -n50

    Omitting the pipe to the head command (which, as I give it, only shows the first 50 lines) instead outputs the whole page as text. This has some advantages over the original server, which was limited to about 400 bytes, but unfortunately doesn’t display just the introductory paragraph, including all the navigation stuff as well.

    I could simply use wget with the same kind of link above to download the page and select out the introductory paragraph using sed or awk, but I’m supposed to be working. 🙂 So I’ll do it later and try to remember to post my results here.

Leave a Reply