jump to navigation

Wikipedia from the Command Line February 9, 2006

Posted by Carthik in ubuntu.
trackback

Philippe Charest shares his home-brewed bash script to get information from Wikipedia on the command line using lynx.

You may have to install lynx first using:
$sudo apt-get install lynx

Phillippe says:

Nice blog by the way, I just wanted to share a new quick “hack” to obtain information from wikipedia on the command line.

Here is a dirty script that fetches information from wikipedia using lynx:

Into your favorite editor:

#!/bin/bash
lynx -dump "http://en.wikipedia.org/wiki/$1" | less

Then just make the file executable ($sudo chmod +x) and in your path (or in /usr/bin)

Exemple (I named my script wikid)

$wikid "George Bush"

returns:


George Bush

From Wikipedia, the free encyclopedia.

Jump to: [6]navigation, [7]search

George Bush can refer to:

People:
* [8]George W. Bush, George Walker Bush, the 43rd and current
[9]President of the United States of America ([10]2001-present)
* [11]George H. W. Bush, George Herbert Walker Bush, 41st President
of the United States ([12]1989-[13]1993), and father of George W.
Bush

Comments»

1. benplaut - February 9, 2006

It would be more useful to open up firefox, but this is really cool, regardless

2. skippy - February 9, 2006

In a similar vein, WWW-Mediawiki-Client allows one to edit MediaWiki content from the command line, using their favorite text editor.
(See here for a Debian package and some basic instructions.)

3. teknokool.net » Wikipedia via the command line - February 9, 2006

[...] Was reading the ubuntu blog today and found this kool little script you can make so you can access Wikipedia via the command line by just creating this little bash script and using lynx which is a text based browser you can use with linux and the terminal screen. [...]

4. Unofficial Indonesian Ubuntu Site » Blog Archive » Wikipedia Command Line - February 10, 2006

[...] Kata ubuntublog di wordpress, pake code: #!/bin/bash lynx -dump “http://en.wikipedia.org/wiki/$1″ | less [...]

5. bagel - February 10, 2006

Hello benplaut;
>>It would be more useful to open up firefox, but this is really cool

#!/bin/bash
firefox “http://en.wikipedia.org/wiki/$1″

should do the job (-;

6. Pascal Klein - February 11, 2006

As for those who like w3m, use this:

#!/bin/bash
w3m “http://en.wikipedia.org/wiki/$1″

Nice script. Thanks. :)

7. Darren Griffith - February 15, 2006

Good tip! And I use this for dictionary look-ups:

#!/bin/sh
lynx -dump -nolist -pseudo_inlines \
‘http://dictionary.reference.com/search?q=’$1’&r=67′ \
| tail -n +13 | less -r

8. Lunatic - February 16, 2006

Really kool! So I can get even more i guess from that. Thnks

9. Lars - February 28, 2006

“WikipediaFS is a mountable Linux virtual file system that enables you to deal with Wikipedia articles as though they were real files on your hard drive.” [ http://wikipediafs.sourceforge.net/ ]

10. mark - April 23, 2006

if you add -nolist the annoying numbers in front of the links will go away.

11. Diario a Borbo · Wikipedia desde la linea de comandos - February 9, 2007

[...] Texto original (inglés) | Ubuntu Blog. [...]

12. sonny - November 11, 2008

I like Opera:

#!bin/bash
opera “w $1″

13. Wikipedia desde la linea de Comandos (Ubuntu) | PIXAN.ORG - November 14, 2008

[...] (Ubuntu) Friday, November 14th, 2008 | Author: admin Pues el otro día me encontré con este post que nos describe una forma fácil de acceder a Wikipedia desde la línea de comandos. Voy a [...]

14. porno sikiş - September 27, 2010

It would be more useful to open up firefox, but this is really cool, regardless

15. sex sikiş - September 28, 2010

Really kool! So I can get even more i guess from that. Thnks


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 518 other followers

%d bloggers like this: