Subscribe for updates and more.

Lynx

Planted 02025-06-21

macOS setup

brew install lynx

Update ~./zshrc to alias lynx to a lynx with a personal config (pick/make a folder to place the lynx configuration into)

alias lynx='lynx -cfg=~/.dotfiles/.lynx/lynx.cfg'

Create Your Personal Lynx Config

cp /opt/homebrew/etc/lynx.cfg ~/.dotfiles/.lynx/lynx.cfg

Create your jump file

touch .lynx_jumps.html
<DT>?<DD><A HREF="file://ABSOLUTE_PATH_TO_FILE/.lynx_jumps.html">This Shortcut List</A>
<DT>gs<DD><A HREF="https://www.google.com/search?q=%s">Google Search</A>
<DT>ghs<DD><A HREF="https://github.com/search?q=%s">GitHub Search</A>
<DT>wiki<DD><A HREF="https://en.wikipedia.org/wiki/%s">Wikipedia Search</A>
<DT>hn<DD><A HREF="https://news.ycombinator.com">Hacker News</A>
<DT>reddit<DD><A HREF="https://www.reddit.com">Reddit</A>

Find and update config.

[…]

STARTFILE:https://news.ycombinator.com/

[…]
JUMPFILE:/ABSOLUTE_PATH_TO_FILE/.lynx_jumps.html

Core Navigation

  • Arrow Keys: Up/Down to select links, Right/Return to follow links, Left to go back
  • q: Quit Lynx
  • g: Go to URL (type any web address)
  • / : Search within current page
  • Space/Page Down: Next page
  • b/Page Up: Previous page

Essential Commands

  • h or ?: Help (your lifeline when stuck)
  • m: Return to main/home page
  • v: View bookmarks
  • a: Add current page to bookmarks
  • p: Print/save page (includes save to file option)
  • \: View HTML source
  • =: Show page info (URL, title, etc.)
  • Delete: Show History Page of links leading to your access of the current document

Quick Start

# Basic usage
lynx                    # Start with default page
lynx google.com         # Go directly to a site
lynx -dump google.com   # Get text output (great for scripts)

Forms & Interactive Elements

  • Tab/Down Arrow: Move between form fields
  • Return/Right Arrow: Activate buttons, enter text fields
  • Space: Toggle checkboxes and radio buttons
  • Return on dropdown: Opens selection menu

Essential Options (Press ‘o’)

  • Display character set: Set to UTF-8 for best compatibility
  • Show cursor: ON (helpful for screen readers and clarity)
  • Editor: Set your preferred text editor
  • User mode: Advanced (gives you more features)

Power User Shortcuts

  • Ctrl-R: Reload current page
  • Ctrl-G: Cancel current operation
  • Ctrl-L: Refresh screen
  • z: Interrupt downloads/connections
  • ** **: Toggle line wrapping (useful for wide content)

Command Line Essentials

lynx -dump URL          # Get plain text of webpage
lynx -source URL        # Get HTML source
lynx -width=120 URL     # Set display width
lynx -anonymous         # Restricted mode (safer browsing)

Pro Tips

  1. Bookmark everything useful - Lynx navigation is slower than graphical browsers
  2. Use -dump for quick info - Perfect for scripts and quick text extraction
  3. Learn the Options menu - ‘o’ key opens configuration that persists
  4. Use ‘g’ liberally - Faster than navigating through links
  5. Remember ‘h’ for help - The built-in help is comprehensive

When You Need More

  • Tables: Use ‘l’ (List) to see all links if table rendering is poor
  • Images: Use ‘*’ to toggle image links if you need to access images
  • Downloads: Use ‘d’ when on a file link to download
  • External editor: ‘e’ to edit local files (if configured)

Advanced Features

Text Processing & Output

# Advanced dumping with formatting
lynx -dump -width=120 -nolist URL           # Clean text, no link list
lynx -dump -with_backspaces URL | less      # Formatted like man pages
lynx -crawl -traversal startpage.html       # Spider entire site for indexing
lynx -source URL | grep "meta name"         # Extract specific HTML elements

Session Management

lynx -session=work.session                  # Save/restore browsing session
lynx -sessionin=saved.session              # Resume from saved session
lynx -cmd_log=commands.log URL              # Record all keystrokes
lynx -cmd_script=replay.txt                 # Replay recorded session

Advanced Navigation

  • ;: View trace log (debugging HTTP requests)
  • Ctrl-X: Cache jar - see all cached documents
  • Ctrl-K: Cookie jar - manage cookies
  • ]: Send HEAD request (get headers only)
  • #: Jump to toolbar/banner if present
  • CTRL-T: Toggle trace mode (detailed logging)

Form Power Features

  • Ctrl-V then e: External editor for textareas (if configured)
  • Ctrl-V then g: Grow textarea (add more lines)
  • Ctrl-V then i: Insert file into textarea
  • d: Download form response instead of displaying it
  • x: Submit form with no-cache (force fresh response)

File Management (DIRED Mode)

When browsing local directories (file://localhost/path/):

  • c: Create new file
  • e: Edit file with external editor
  • f: Full menu of file operations
  • m: Modify (rename/move) file
  • r: Remove file/directory
  • t: Tag files for batch operations
  • u: Upload file to directory

Display Customization

  • ** **: Toggle line wrapping (with width options)
  • { and }: Scroll left/right for wide content
  • @: Toggle raw 8-bit/CJK character mode
  • [: Toggle pseudo-ALT text for images
  • *: Toggle image links on/off
  • Ctrl-L: Refresh display

Advanced Bookmarks

  • Set multi-bookmarks to ADVANCED in options
  • Create up to 26 bookmark files (A-Z)
  • Use bookmark subdirectories: ./bookmarks/work.html
  • Edit bookmark files directly with external editor

Jump Commands (Custom Shortcuts)

Create ~/.lynx_jump file with shortcuts:

google  http://www.google.com/search?q=%s
wiki    https://en.wikipedia.org/wiki/%s
news    https://news.ycombinator.com

Then use j followed by shortcut name.

Security & Privacy Features

lynx -anonymous                             # Restricted anonymous mode
lynx -restrictions=all                      # Maximum restrictions
lynx -validate                              # Only allow HTTP URLs
lynx -noredir                               # Don't follow redirects
lynx -noreferer                            # Don't send referrer headers

Network Debugging

lynx -trace -stderr URL 2> debug.log       # Full HTTP trace to file
lynx -head URL                              # Get headers only
lynx -mime_header -source URL               # Include MIME headers in source
lynx -connect_timeout=30 URL                # Set connection timeout

Batch Processing & Automation

# Web scraping pipeline
lynx -dump -listonly URL | grep "http" | \
  while read url; do lynx -dump "$url" >> data.txt; done

# Monitor webpage changes
lynx -dump URL > current.txt
diff previous.txt current.txt

# Extract all links from a page
lynx -dump -listonly URL | grep "^[[:space:]]*[0-9]"

Configuration Power Tips

Edit ~/.lynxrc or use command line:

lynx -assume_charset=UTF-8                  # Handle broken encoding
lynx -cookie_file=custom_cookies.txt        # Custom cookie storage
lynx -display_charset=UTF-8                 # Set display encoding
lynx -editor=vim                            # Set external editor
lynx -useragent="Custom Bot 1.0"           # Custom user agent

Advanced Search & Navigation

  • n: Repeat last search
  • CTRL-A: Jump to beginning of document
  • CTRL-E: Jump to end of document
  • ( and ): Half-page up/down
  • CTRL-P/N: Two-line up/down movement
  • E: Edit current link URL and go to it
  • G: Edit current page URL and go to it

External Program Integration

Configure in lynx.cfg:

EXTERNAL:http:xdg-open %s:TRUE
PRINTER:Save to PDF:lpr -P PDF %s:TRUE
DOWNLOADER:wget:wget %s:TRUE

Table Handling

  • l: List all links when tables render poorly
  • Use -width=200 for better table formatting
  • Enable TRST (simple table rendering) in config
  • Convert complex tables with external scripts

Advanced Form Techniques

  • Use Tab to move forward through fields efficiently
  • Shift-Tab: Move backward through fields (if supported)
  • Ctrl-V prefix to escape from text fields temporarily
  • Submit forms with GET method allow bookmarking results

Memory & Performance

lynx -cache=50                              # Increase document cache
lynx -partial                               # Enable partial page display
lynx -partial_thres=200                     # Set partial display threshold
lynx -stack_dump                            # Debug memory issues

Pro Automation Examples

# Daily news digest
lynx -dump news_site.com | head -50 | mail -s "Daily News" user@domain

# Website monitoring script
#!/bin/bash
URL="$1"
lynx -dump "$URL" | md5sum > current.md5
if ! cmp -s current.md5 previous.md5; then
    echo "Website changed!" | mail -s "Change Alert" admin@domain
fi
mv current.md5 previous.md5

# Bulk link checking
lynx -traversal -crawl startpage.html
grep "ERROR" *.html

Terminal Integration

  • Set TERM variable for optimal display
  • Use with tmux/screen for persistent sessions
  • Configure terminal for proper color support
  • Set up keyboard shortcuts for common Lynx commands

Remember: These advanced features make Lynx incredibly powerful for automation, debugging, and specialized workflows. Start with the basics, then add these techniques as your needs grow.