CLI Magic: Lynx


Author: Joe Barr

This time I’ve gone too far. Espousing the use of a text-based web browser is like encouraging honesty at Microsoft. The very notion of a text interface for the Web runs against the grain. Nonetheless, that’s what we’re doing this week here on the CLI frontier. Come read about a lean, mean, text-based browsing machine that’s faster than a lynx. Actually, it is a Lynx.If Lynx is not included in your distribution, you can always find the latest version here. There is a Users Guide and Help Page there as well.

Getting started using Lynx is easy. Just enter this at the CLI:


Without any arguments at all, Lynx opens to its own help page. But the Lynx commands are so easy to learn and to use that you won’t need to spend much time at the help page. If you know which arrow is up, you’re halfway home already.

For example, let’s take a look at as she is seen by a Lynx user. Enter this:


You’ll get results similar to those shown below. The first thing you’ll see is the Lynx message bar at the bottom of your terminal window. It will take a second or two to figure out that a “www.” is needed before the “”, then will be loaded.

The top line of the Lynx window displays the current site, page number, and number of pages for the link. That number of pages does not refef to the number of HTML pages, that is a constant of one. It’s the number of screens of information Lynx has to display about the current page. Use Pg Up/Pg Dwn keys to travel between the pages.

Click to enlarge

Note that the first link on the top of the page is colored red. That’s the current link. To navigate around the links, use the up and down arrow keys. Five down arrows, for example, highlights the link for Slashdot. At any link, a right arrow takes you to that destination, and a left arrow returns you to wherever you came from.

Throw in the Q (or q) key to quit Lynx, and you’ve already got the basics down. But of course, you know there must be more. And there is, plenty more.

Here are a few handy CTL key combinations for your Lynx surfing pleasure:

  • CTL-A Go to beginning of current document
  • CTL-E Go to end of current document
  • CTL-N Advance 2 lines
  • CTL-P Go back 2 lines

On most systems, the Ins/Del keys match up with CTL-N and CTL-P. And one keypress always beats a pair.

What else? Well, it can handle the gopher protocol, browse FTP directories, and display text files in those directories, as well. I’ve read elsewhere that it is possible to do binary file downloads with Lynx, but when I tried it I had no luck. Perhaps one of our more knowledgeable readers will speak up and let us know if this is doable or not, and if it is, explain how to do it.

You can also browse files on your local system with Lynx. Try this:

lynx /etc/services

When viewing text files like this one, the up and down arrow keys will forward and back a full screen each time you press them.

As always, I refer you to the man — and the Help Page, and the Users Guide — to further your enjoyment of this cool little tool.