Use links for repeatable text-mode web checks

links is a text-mode browser, and this guide turns the same browsing work into commands you can check or script. The installed package here is links 2.29-1build6, and the executable reports Links 2.29. Allow about fifteen minutes. You need a shell, a URL or local HTML file, and permission to read the destination. The examples only read pages unless you deliberately save downloads or change browser settings.

Checkpoint: The quickest useful result is links -dump https://example.com/. It prints formatted page text and exits, so it works in a terminal without an interactive session.

1. Confirm the installed build

Check which executable will run and record its version:

$ command -v links
/usr/bin/links
$ links -version
Links 2.29

The www-browser manpage on this system is an identical alias for the links manpage. If a script calls www-browser, check its target with command -v www-browser and do not assume that another distribution uses the same package layout.

2. Read a page without opening the full-screen browser

Use -dump when you want formatted text on standard output:

$ links -dump https://example.com/

The command renders the document for output rather than opening the ncurses interface. Links and headings are represented in the text output, but this is not a substitute for checking the page in a graphical browser. The URL may be an HTTP, HTTPS, FTP or local file:// URL according to the installed manual.

To make wrapping reproducible, add a width:

$ links -dump -width 72 https://example.com/ > example.txt
$ sed -n '1,40p' example.txt

-width controls formatting for -dump. A long unbreakable line can still exceed it. The redirection creates or truncates example.txt, so choose a new filename when the existing report matters. To replace a report safely, write to a temporary name, inspect it, then use mv only after the command succeeds.

Checkpoint: A successful dump gives you readable output and a zero exit status. Capture the status immediately if a script depends on it:

$ links -dump https://example.com/ > /tmp/example-links.txt
$ printf '%s\n' "$?"
0

3. Fetch the original data instead of rendered text

Use -source when you need the unformatted response body:

$ links -source https://example.com/ > example.html
$ sed -n '1,20p' example.html

This is useful for a small inspection pipeline, but it does not make the response trustworthy. Treat downloaded HTML as data. Do not pipe it into a shell, an interpreter or an editor command that executes embedded instructions. If you only need to see the rendered words, use -dump and avoid creating a file.

-force-html changes how files with an unknown type are treated. It does not repair invalid HTML, and it is not needed for a normal HTTP page with a useful content type. Use it only when you have a specific local or remote document whose type is misleading:

$ links -dump -force-html file:///path/to/page.data

4. Browse interactively in text mode

Start an interactive session with a URL. -no-g forces the text driver if a previous setting or launcher requested graphics:

$ links -no-g https://example.com/

Use the arrow keys or Tab to move between links, Enter to follow the selected link, and Left to go back. Page Down or Space moves down; b moves up. Press g to enter a URL, / to search the current page, n for the next match, and q to quit. Q quits without asking, so use ordinary q when you want the normal exit prompt.

Press \ to toggle between rendered HTML and source view. That view is for inspection, not validation: a page can contain misleading markup or links. d starts downloading the selected link, which changes local state and can consume disk space. Check the destination before accepting a download, and do not grant elevated privileges merely to browse a page.

5. Keep network and privacy defaults explicit

The manpage gives the installed defaults for several connection controls: up to 10 concurrent connections overall, up to 2 to one host, 3 retries, a 120-second receive timeout and a 600-second timeout for non-restartable connections. These affect waiting and load, not the content's trustworthiness. For a bounded one-off text check, set only the limit you have a reason to change:

$ links -dump -retries 1 -receive-timeout 30 https://example.com/

Proxy options are named -http-proxy, -https-proxy, -ftp-proxy and -socks-proxy. An empty proxy is the documented default. A proxy can observe or alter traffic according to its policy, so use the proxy required by your network rather than copying a value from an unrelated shell session. -only-proxies 1 prevents non-proxy connections, which is useful only when you have configured the required proxy and want a failure instead of a direct connection.

HTTPS certificate handling deserves a deliberate choice. -ssl.certificates 1 is the default and warns about an invalid certificate; 2 rejects it; 0 ignores it. Do not use 0 to silence a warning in a script that handles credentials or sensitive information. A warning is a checkpoint to inspect the URL, clock, trust store and network path.

Cookies and history are separate settings. The manpage lists -enable-cookies, -save-cookies and -save-url-history. If you do not need a session, prefer a dump command and avoid interactive state. Never put a password in a command line option or a captured shell transcript. The browser's per-user configuration is ~/.links2/links.cfg, created automatically by links; protect it as user data and review it before copying it to another account.

6. Diagnose a failure without guessing

First separate a missing command from a network or document problem:

$ command -v links
$ links -version
$ links -dump https://example.com/ > /tmp/example-links.txt
$ printf 'exit=%s\n' "$?"

If command -v finds nothing, install the distribution's links package through its normal package manager. If version output works but the dump fails, inspect the URL, DNS, proxy and certificate message. Try a known local file with file:///path/to/page.html to distinguish browser rendering from network access. For a page that is empty or badly wrapped, compare -dump with -source, and try an explicit -width. Do not treat a successful fetch as proof that links, forms, frames or scripts behave as they would in a modern browser.

No step in this guide requires sudo. If a local file or download directory is inaccessible, fix ownership or permissions through the system's normal change process rather than running the browser as root. Running a browser with elevated privileges increases the impact of a malicious page or viewer association.

Done means