Saturday, May 8, 2021
HomeLinuxHow to Search Wikipedia by command Line on Ubuntu Linux

How to Search Wikipedia by command Line on Ubuntu Linux

Browsing anything through the terminal shell on Linux gives a professional and power user vibe. There are plenty of pieces of stuff that you actually can do through the terminal shell despite using it on a conventional method. If you’re an internet folk, no wonder you use google or Wikipedia quite often a day. Guess what? In Linux, there are ways to search things on Wikipedia by command line (terminal shell).

Search on Wikipedia by Command Line

Linux allows you to access the web browser through the terminal tool, which can perform web searches and queries through the command-line interface (CLI). You can either use a general terminal tool for web searching via CLI or, you can also use Wikit, a dedicated command-line tool to search on Wikipedia. In this post, we will see two different methods to see how to search Wikipedia by command line on Ubuntu and other Debian-based Linux distributions.

Method 1: Use Wikipedia Through wikipedia2text by Command Line

As I already have mentioned that Links is a CLI tool for Linux that can offer web access through the command line. Before searching anything on Wikipedia through the terminal command-line, ensure that you have the wikipedia2text installed on your system.

Step 1: Install Links and wikipedia2text

After installing Links, we’ll be able to run commands to search pieces of stuff on the web via the command-line interface. In this step, we’ll first install Links; then, we’ll install the Wikipedia command tools. You can use the following command lines on your terminal shell to install Links and wikipedia2text on your Ubuntu system. The commands require root permission; make sure you have it.

sudo apt install links
sudo apt-get install wikipedia2text

install links

Step 2: Get Started With wikipedia2text

After installing the Links and the Wikipedia2text tool on your Linux system, you can now run it. First, you can check the help section to get used to the syntaxes and the commands.

wikipedia2text -help

You can now run the following command on your command-line to search ‘Linux’ on Wikipedia through your terminal shell. Change the word ‘Linux’ to anything that you want to browse on Wikipedia.

wikipedia2text Linux

You can add the -p syntax with your command to see a little preview of the search result.

wikipedia2text -p Linux

The following command will generate a web link for your Wikipedia search result that you can use on a browser.

wikipedia2text -u Debian Linux

wikipedia2text -u Debian Linux

Method 2: Seach On Wikipedia Through wikit On Command Line

Wikit is the short form of Wikipedia; it is a command tool for browsing Wikipedia through the command-line interface. Here, we’ll see the method of how to install and use Wikit on a Linux system.

Step 1: Install Nodejs and Wikit

Installing the Wikit on a Debian-based Linux system requires the NPM (Node Package Manager) and Nodejs support. First, run the following command on your terminal shell to install the Nodejs package on your system.

$ sudo apt install nodejs

nstall nodejs

After installing the Nodejs, run the following npm command with a -g flag to install the global version of the Wikit tool on your Linux system. Installing the Wikit won’t take long; as soon it finishes the installation, you can get started with the Wikit tool.

$ sudo npm install wikit -g

NPM Wikipedia by command line

Step 2: Use Wikit on Ubuntu Linux

After installing the Wikit on a Ubuntu system, it’s time to search for something on Wikipedia via the Wikit command line. Here, I’m going to search ‘Linux’ on Wikipedia via the Wikit command. The search results will be displayed and warped on your terminal shell according to your terminal’s current display ratio.

$ wikit Linux

Wikipedia by command line

Run the following command with a -b flag on your terminal shell if you want to open the search result through a browser.

$ wikit linux -b

You can also define the number of lines you want to display on the terminal shell for any Wikipedia search result.

$ wikit linux -l 90

Final Words

In the entire post, we have seen two different methods of using Wikipedia through the command line on a Ubuntu Linux system. You can choose any of these methods to browse Wikipedia. Please share this post with your friends and the Linux community if you find this post useful and handy. Let us know if you have any opinions regarding this post in the comment section.


Please enter your comment!
Please enter your name here


Latest Post

Must Read