How to convert a Wikipedia article to a text file using the Linux command line.

Posted: July 27, 2015. At: 1:37 PM. This was 2 years ago. Post ID: 8272
Page permalink.
WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters. These cookies expire two weeks after they are set.

The wikipedia2text command allows a command line user on Debian to output the contents of a Wikipedia article to a text file on your hard drive.

Install this command this way:

[email protected]:~/Documents$ sudo apt-get install wikipedia2text

Then convert an article this way.

[email protected]:~/Documents$ wikipedia2text Debian > Debian.txt

I enter the name of the article I am looking for instead of the URL. This creates a very readable text file and this is a great way to save an article that the user may read with less or VIM.

Use this command to open a random page for reading.

[email protected]:~/Documents$ wikipedia2text -r | less

And this is how to retrieve just the URL of the page.

jason@darkstar:~/Documents$ wikipedia2text -u UNIX
http://en.wikipedia.org/wiki/UNIX

Specify the language with the -l parameter thusly:

[email protected]:~/Documents$ wikipedia2text -l de -r

This is therefore a very useful tool for a Linux user who wishes to save information from Wikipedia to their hard drive for later reference.

No comments have been made. Use this form to start the conversation :)

Leave a Reply