Posted: . At: 1:37 PM. This was 9 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.


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


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:

jason@darkstar:~/Documents$ sudo apt-get install wikipedia2text

Then convert an article this way.

jason@darkstar:~/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.

jason@darkstar:~/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:

jason@darkstar:~/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.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.