The read command extracts and displays the content of specific articles from ZIM archive files. It supports multiple article lookup strategies and provides intelligent content rendering for optimal terminal viewing.
The read command provides two main usage patterns:
- File-specific reading - Read an article from a specific ZIM file
- Unified search - Search all available ZIM files for an article
zim read <file.zim or name> <article>Examples:
zim read english-wikipedia.zim "Main_Page"
zim read wikipedia_fr "France"
zim read ~/.cache/zim/english-wikipedia.zim "Python (programming_language)"zim read <article>The command searches all ZIM files in your library and prioritizes Wikipedia files:
zim read "Albert Einstein"
zim read "Machine Learning"
zim read "The Great Gatsby"The read command uses sophisticated article finding strategies to locate articles even with imperfect matching:
- Exact Match - Looks for the exact article title in both modern ('C') and legacy ('A') namespaces
- Space/Underscore Variants - Automatically tries:
Main_Page↔Main PagePython_(programming_language)↔Python (programming language)
- Parenthetical Cleanup - Removes disambiguation numbers like "(3671)" from titles
- Cross-File Search - For Wikipedia files, searches all available Wikipedia ZIM files if not found in the current one
In unified search mode, files are prioritized based on content:
- Wikipedia files get priority over other ZIM types
- Wikipedia files are smart-ordered by language and scope (all languages, history editions, etc.)
The command intelligently formats content based on its type:
Plain text content is displayed as-is:
Article: Introduction
======================
This is a plain text article with no formatting.
Multiple paragraphs are preserved.
HTML content is processed for optimal terminal display:
- HTML tags are stripped
- CSS and JavaScript are removed
- Text structure is preserved with:
- Headings converted to
## Titleformat - Lists shown with bullet points (
•) - Paragraphs separated by double newlines
- Headings converted to
- MediaWiki CSS artifacts are specially filtered
Binary bodies are consumed as a stream to verify the archive read without retaining the payload in memory. Use zim extract when the bytes themselves are needed.
For non-text content (images, PDFs, etc.):
Content-Type: image/png
Size: 45.2 KB
💾 Binary content - use 'zim extract' command to save to file
For each article found, the command displays:
📄 Article: Albert Einstein
===============================
📊 Size: 12.3 KB
✅ Found: Albert Einstein
🔄 Redirected to: Albert_Einstein
If HTML is detected but stripped content is minimal:
⚠️ This article appears to be mostly formatting/styles.
💡 Try using: zim serve english-wikipedia.zim
Then browse to http://localhost:8080 for better viewing
The command follows up to 5 redirect hops to find the final article content and shows the redirect path.
zim read "Albert Einstein"Output:
✨ Searching all ZIM files for: Albert Einstein
📚 Found in: english-wikipedia.zim
🔍 Looking for: Albert Einstein
✅ Found: Albert Einstein
📄 Article: Albert Einstein
===============================
📊 Size: 12.3 KB
Albert Einstein (14 March 1879 – 18 April 1955) was a German-born
theoretical physicist who is widely held to be one of the greatest
and most influential scientists of all time...
zim read "Python_(programming_language)"The command automatically tries both variants:
Python_(programming_language)Python (programming language)
zim read "US"Output might show:
🔍 Looking for: US
✅ Found: US
🔄 Redirected to: United_States
📄 Article: United States
==========================
📊 Size: 45.7 KB
The United States of America (USA) is a country primarily located
in North America...
zim read commons:Logo_of_Wikimedia_Foundation.svgOutput:
Content-Type: image/svg+xml
Size: 2.1 KB
💾 Binary content - use 'zim extract' command to save to file
❌ Article not found: Some Article
💡 Try: zim search english-wikipedia.zim "Some Article"
❌ Article "Some Article" not found in any ZIM file
💡 Try: zim search "Some Article" for similar articles
❌ Failed to follow redirect: redirect chain broken
- Article not found: Use
zim searchto find similar articles - Redirect errors: The article may have a broken redirect chain
- Permission errors: Ensure you have read access to the ZIM file
- Use exact titles when possible for faster lookup
- For HTML-heavy articles, consider using
zim servefor better viewing - Unified search is convenient but may be slower for the first article lookup
zim search- Find articles by keywordzim list- List all articles in a ZIM filezim extract- Extract binary content to fileszim serve- Start a web server for browsing ZIM content