Skip Navigation

Text Mode Web Browsers

Most of the time, we can rely on having a second computer or device available for reading instructions while we perform system administration tasks. However, in some situations, we might only have access to the system on which we are working. If all we have available is a command line interface, we will need to use a text mode Web browser to access the Internet to find documentation.

Page Contents

Browsing from the Command Line

Not all systems have a Graphical User Interface (GUI). For example, we normally don’t run a GUI at all on a server, since servers normally don’t have a user at the keyboard, and adding a GUI only serves to increase the system’s attack surface. On desktop systems, we will often install a GUI, but sometimes we need to download a file or look up some information to configure a graphics driver or desktop.

When the command line is the only thing available, a text mode Web browser allows for basic access to Internet websites. Many sites will not work properly with these browsers, either due to layouts that assume a graphical browser or reliance upon JavaScript. However, sites that are optimized for accessibility normally will be functional with text mode Web browsers, since these browsers have a lot in common with the capabilities of screen readers. For this reason, text mode Web browsers are a useful tool for testing site accessibility.

On Alpine Linux, there are (at least) 3 choices of text mode Web browser:

Of these choices, Lynx seems to work the best in testing and will therefore be the focus of the rest of this page.

Installing Lynx

Installing Lynx on Alpine Linux is straightforward:

doas apk add lynx

If using the Z Shell, remember to rehash.

Using Lynx

The easiest way to start Lynx and visit a website is to put the URL of the site as an argument to the lynx command, like so:

lynx https://www.duckduckgo.com/html

Once the site opens, navigation within a page is performed using the up and down arrow keys. The arrow keys both navigate between links and scroll pages of text. To activate a link and move to another page, use either the right arrow key or the Enter key. The left arrow key is the “back” button.

The Page Up and Page Down buttons can be used for quickly moving up and down by screen-sized pages of text, instead of stopping on every link. In most cases, the space bar can also be used to move down by a whole page of text.

To visit a different website, press the g key (for “go”). A URL prompt will appear at the bottom to ask for the new address to open. Simply type in the URL and press Enter to go to the new site.

Although Lynx doesn’t support JavaScript, it does support cookies. Some sites will try to set cookies. Lynx will normally prompt with a message at the bottom to ask what to do with the cookie. The letter in parenthesis corresponds to the key to press to choose the specified option.

If you want to download a file from a link, highlight the link with the up and down arrow keys, then press the d key to download. If you try to open a link to content that Lynx cannot handle, you will normally be prompted to download that file automatically.

When finished browsing, press the q (“quit”) key. A confirmation message will appear. Answering y to this confirmation will exit Lynx.

More detailed information about Lynx, its user interface, and its capabilities can be found in the Lynx Users Guide.