LinuxCommandLibrary

w3m

Browse the web in a text-based interface

TLDR

Open a URL

$ w3m [https://example.com]
copy

Open a URL in monochrome mode
$ w3m [https://example.com] -M
copy

Open a URL without mouse support
$ w3m [https://example.com] -no-mouse
copy

Open a new browser tab
$ <Shift t>
copy

Display your browser history
$ <Ctrl h>
copy

Quit w3m
$ <q><y>
copy

SYNOPSIS

w3m [options] [URL_or_file]

PARAMETERS

-dump
    Dumps the formatted source of the URL or file to standard output, without interactive browsing.

-cols N
    Sets the number of columns (width) for rendering the page.

-version
    Prints the w3m version number and exits.

-no-proxy
    Disables the use of any configured HTTP/FTP proxy.

-s
    Squashes multiple spaces in the output into a single space.

-I encoding
    Specifies the input character encoding of the document.

-O encoding
    Specifies the output character encoding when dumping or saving a page.

-T type
    Specifies the content type of the input (e.g., 'text/html', 'text/plain').

-F
    Follows symbolic links when accessing local files.

-M
    Forces monochromatic display, useful for terminals without color support.

-B
    Starts the browser with the 'back' command, useful for returning to previous pages from scripts.

DESCRIPTION

w3m is a free and open-source text-based web browser and pager. Unlike graphical browsers, w3m operates entirely within the terminal, making it incredibly lightweight and fast. It's an excellent tool for accessing web content in environments where a graphical interface isn't available, such as via SSH connections, or on systems with limited resources.

Despite its text-only nature, w3m is quite capable. It supports tables, frames, SSL, and can even display inline images (though often requires an external viewer configured). It provides basic navigation features like history, bookmarks, and text search within pages. w3m is particularly useful for scripting purposes, allowing users to quickly parse and extract information from web pages using its "dump" mode. Its efficiency and low resource footprint make it a staple for system administrators, developers, and anyone needing quick web access without the overhead of a full GUI browser.

CAVEATS

While w3m is powerful for a text-based browser, it has inherent limitations compared to modern graphical browsers. It does not execute JavaScript, limiting its functionality on dynamic web pages. CSS support is minimal or non-existent, meaning page layouts might appear very basic or broken. Multimedia content like videos and complex animations are not supported. Its interaction is entirely keyboard-driven, which can have a learning curve for users accustomed to mouse navigation.

INTERACTIVE USAGE

In interactive mode, w3m is primarily navigated using keyboard shortcuts. Common keys include: Arrow keys for scrolling, Spacebar for page down, b for page up, Enter to follow a link, u for URL input, / for search, B for back, q to quit. A comprehensive list of key bindings can be found by pressing ? inside w3m.

CONFIGURATION

w3m's behavior can be customized through configuration files, typically located in ~/.w3m/. These files include config for general settings, keymap for customizing key bindings, and mouse for mouse actions. Users can also define external viewers for different MIME types in the mailcap file.

HISTORY

w3m was originally developed by Akinori Kimura and first publicly released around 1999. Its name is derived from "WWW wo Miru" which translates to "to see WWW" in Japanese. It quickly gained popularity as a lightweight and efficient alternative to other text-mode browsers like Lynx, especially due to its ability to render tables more accurately and its more modern feature set at the time. It continues to be maintained and is a standard utility on many Unix-like operating systems, valued for its utility in scripting and low-resource environments.

SEE ALSO

lynx(1), links(1), elinks(1), curl(1), wget(1)

Copied to clipboard