w3m: Introuduction to the text-based terminal web-browser.

w3m: Introuduction to the text-based terminal web-browser.

This is a useful tool for system administrators and developers for troubleshooting.

w3m is a terminal app (CLI), text-based web browser and pager with support for tables, frames, SSL connections, and inline image viewing (in compatible terminals).

w3m Basic Usage

Introduction

w3m is a text-based web browser and pager with support for tables, frames, SSL connections, and inline image viewing (in compatible terminals).

Launching w3m

Start w3m by running in your terminal:

w3m [options] [URL|file]

Example:

w3m https://www.example.com
  • Arrow Keys: Move between links (up/down) and scroll content (left/right).
  • Enter: Follow the selected link.
  • B: Go back to the previous page.
  • U: Open a new URL (prompts for input).
  • G: Prompt to enter a URL to go to.
  • PgUp / PgDn: Jump one screen up or down.
  • ^L: Refresh/redisplay the current page.
  • q or Q: Quit w3m (Q quits without confirmation).

Searching

  • /: Search forward for text.
  • ?: Search backward for text.
  • n: Move to the next search match.
  • N: Move to the previous search match.

Viewing Images

In compatible terminals (e.g., iTerm2, Kitty):

  • Use -I to load and display inline images:
    w3m -I https://example.com/image.png
    
  • Inside w3m, press I to toggle image display on/off.

Tables and Frames

w3m can render simple tables and HTML frames. No special options are required; content is formatted for text display.

Bookmarks

  • m: Bookmark the current page.
  • M: Show list of bookmarks.
  • S: Save bookmarks to ~/.w3m/bookmark.html.

Cookies and Sessions

  • Use -cookie to enable cookie support:
    w3m -cookie https://example.com
    
  • Cookies are stored by default in ~/.w3m/cookie.

Saving Content

  • s: Save the current page (prompts for filename and format).
  • >: Dump the current page to a text file.
  • <: Load a local file into w3m.

Configuration Options

  • -T text/html: Specify content type manually.
  • -cols <n>: Set terminal column width for rendering.
  • -o <name>=<value>: Override configuration options (e.g., -o display_link_number=1).

Help and Manual

  • Press H inside w3m for a quick help screen.
  • For full documentation, run:
    man w3m
    

 

w3m Use Cases

General Use Cases

  • Lightweight browsing on low‑resource machines
    Ideal for systems without a graphical environment (embedded devices, headless servers, old hardware).
  • Browsing over slow or unreliable links
    Text‑only rendering means pages load fast even on dial‑up, slow mobile connections, or high‑latency SSH sessions.
  • Reading online documentation
    View man pages, RFCs, HOWTOs, wiki pages, or API docs in the same terminal you’re working in.
  • Offline “snapshot” of pages
    Save a page as plain text (> filename.txt) for later reading or archival.
  • Accessibility
    Use with speech‑to‑text tools or screen readers for visually impaired browsing.

System Administrator Use Cases

  1. Quick health‑check of web services

    w3m -dump_head https://intranet.example.com/status
    

    Verify HTTP status, headers, and basic page content without leaving your SSH session.

  2. Testing basic authentication and SSL

    w3m -o http_proxy=http://proxy:3128 -o ssl_verify=0 https://secure.example.com
    

    Validate proxy settings, cert acceptance, and login prompts interactively.

  3. Pulling down configuration files or logs

    w3m -dump https://updates.example.com/latest-config > /tmp/config.txt
    

    Automate retrieval of device configs or patch lists in shell scripts.

  4. Inline image preview for monitoring graphs
    In a terminal that supports it (Kitty, iTerm2), you can view PNG charts or dashboard snapshots:

    w3m -I https://monitor.example.com/metrics.png
    
  5. Bookmarking intranet tools
    Save frequently used internal pages (e.g. ticketing system, wiki) to ~/.w3m/bookmark.html and launch with w3m -M.

Developer Use Cases

  • Local HTML/CSS prototyping

    w3m file://$PWD/index.html
    

    Quickly validate that your static pages render in a text‑only environment.

  • Automated link‑checking

    for url in $(cat links.txt); do
      w3m -dump_head $url | grep HTTP
    done
    
  • Inline editing of pages
    Combine with vim to tweak HTML on the fly:

    w3m -dump file.html > temp.txt && vim temp.txt
    
  • Script‑driven scraping or data‑extraction
    Use w3m -dump in cron jobs to pull down structured text (lists, tables) for parsing by awk/grep/jq.

  • Viewing API responses
    If you host a REST endpoint that returns HTML or raw data, w3m can render it the same way a browser would—handy for debugging.

Why w3m Belongs in Your Toolkit

  • Scriptable & automatable — Integrate into shell scripts, cron, or CI pipelines.
  • Low dependencies — No X11, no heavy libraries—just a fast, portable binary.
  • Familiar keybindings — Vi‑style and arrow keys make navigation intuitive.
  • Extensible — Through -o options you can tweak everything from proxy settings to inline‑image behavior.