Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
How to Search Wikipedia Pages in Linux Command Line?
The wp-cli tool provides a convenient way to search and access Wikipedia pages directly from the Linux command line. This command-line interface leverages the Wikipedia API to retrieve information and display it in your terminal without requiring a web browser, making it ideal for quick research and information lookup.
Installing wp-cli
First, install the wp-cli package on your Linux system using the package manager
sudo apt install wp-cli
Reading package lists... Done Building dependency tree... Done The following packages will be installed: wp-cli 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Setting up wp-cli (2.8.1-1) ... Processing triggers for man-db (2.10.2-1) ...
Once installed, the wp command becomes available in your terminal for Wikipedia searches and content retrieval.
Searching Wikipedia Articles
Use the --search option to find articles related to your topic. This returns a list of matching articles with brief descriptions
wp --search Linux
+---------------+----------------------------------------------------+---------+ | Title | Description | Page ID | +---------------+----------------------------------------------------+---------+ | Linux | Family of open-source Unix-like operating systems | 18978 | | Linux kernel | Core of the Linux operating system | 6097297 | | Ubuntu | Linux distribution based on Debian | 31768 | | Red Hat Linux | Linux distribution by Red Hat | 158836 | | Linux Mint | Ubuntu-based Linux distribution | 2042297 | +---------------+----------------------------------------------------+---------+
Getting Article Summaries
Retrieve a concise summary of any Wikipedia article using the --summary option
wp --summary Linux
Linux is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, which includes the kernel and supporting system software and libraries, many of which are provided by the GNU Project.
Extracting Full Articles
For complete article content, use the --extract option to display the full Wikipedia page text
wp --extract "Operating System"
This command retrieves and displays the entire Wikipedia article in a terminal-friendly format, including all sections, headings, and content.
Multi-language Support
Access Wikipedia articles in different languages using the --lang option followed by the appropriate language code
wp --extract Linux --lang fr wp --summary "Computer Science" --lang es wp --search Technology --lang de
Common language codes include fr (French), es (Spanish), de (German), ja (Japanese), and zh (Chinese).
Key Features
| Command | Function | Usage |
|---|---|---|
--search |
Find articles by keyword | wp --search "topic" |
--summary |
Get brief article overview | wp --summary "Article Title" |
--extract |
Retrieve full article text | wp --extract "Article Title" |
--lang |
Specify article language | wp --summary "Topic" --lang fr |
Requirements
Internet connection Required to access Wikipedia's API servers
Terminal access Works in any Linux terminal or command prompt
Package manager Uses apt, yum, or other package managers for installation
Conclusion
The wp-cli tool transforms your Linux terminal into a powerful Wikipedia research interface. It enables quick searches, article summaries, and full content extraction without leaving the command line, making it an essential tool for developers, researchers, and Linux enthusiasts who prefer terminal-based workflows.
