June 14, 2004

CLI magic: Console surfing with Lynx

Author: Joe Barr

Remember that sense of high-tech adventure you first felt when you began to explore the Internet? The amazement that in the blink of an eye you could be connected to a site in Paris, or Moscow, or San Francisco? Of course, that was before the WWW became the world wide wait. The slowdown of the Web is due to primarily to g-forces, and I don't mean gravity. It's the weight of that damn GUI you're reclining in. Come on, you lazy louts, I'll show you one way to regain that sense of cutting-edge adventure by surfing from the console. Meet Lynx, the senior member of the text-based browsing club.

Quoting from the Web History page at LivingInternet.com:

Lynx. The University of Kansas had written a hypertext browser independently of the Web, called Lynx, used to distribute campus information. A student named Lou Montulli added an Internet interface to the program, and released the Web browser Lynx 2.0 in March, 1993. Lynx quickly became the preferred Web browser for character-mode terminals without graphics, and remains in use today.

Release 2.8.5 is the current stable release of Lynx.

Your first use of Lynx may give you a bit of a shock, as it is a whole 'nother way of surfing: you use your fingertips and type instead of moving a mouse. Here are a few basic commands you'll want to learn right away, demonstrated by using the Linux.com home page. Get started on this magical mystery tour by entering lynx www.linux.com in your console window.

In Lynx, the arrow keys can do a lot of things for you. The down arrow, for example, moves the highlighted text to the next item on the screen. Looking at the Lynx screenshot of Linux.com, down-arrow moves the highlight from "The Enterprise Linux Resource" to "Search Linux.com." Down-arrow again takes you from there to "Linux.com RSS." The up-arrow key reverses the direction of movement.

OK, that gives us a little movement, but what about big jumps? If the highlighted text is a link, right-arrow takes you there and left-arrow brings you back. Not just cool, it's fast.

At the bottom of the Lynx screenshot you can see the onscreen help display. It advises that you to press: H for Help, O for Options, P for Print, G for Go, M for Main screen, and Q for Quit. The question mark key also works for help, and the Enter key works the same as the right-arrow, taking you to the link associated with the highlighted text. To search for a word or phrase in the current document, use the slash key.

By the way, the Options selection is very handy. It allows you set the user mode (Noobie, Intermediate, Advanced), specify what to do with Cookies (Ignore, Ask, Accept all), and so on, and how to deal with images (Ignore, Show as labels, Show as links).

Click to enlarge

Another setting in Options allows you to enter the "User Agent" data sent to the Web server, so if you come across a site that is blocking your access because you're not using its preferred operating system or browser, you can make the feeble-minded fools happy by telling them whatever they want to hear. (Don't think this no longer happens -- Microsoft recently settled out of court with Opera for deliberately hosing the way screens were displayed with the Opera browser.)

You can configure Lynx to display images using an external viewer, if you like. But to me, using Lynx and showing images is sort of like standing in a long line to tell someone you're not going to wait any longer. It doesn't make sense.

Although Lynx is character-based, it is a complex and sophisticated tool. Lynx includes a configuration file (/etc/lynx.cfg) that you can tweak in all manner of ways to custom-fit Lynx to your desires.

The best way to learn how to use Lynx fully is to start using it, then learn more as you go about its configuration by reading the complete Lynx User Guide. Meanwhile, here are a few more handy keystroke commands, taken from Online Help.

+ Scroll down to next page (Page-Down)
- Scroll up to previous page (Page-Up)
c Create a new file
d Download selected file
f Show a full menu of options for current file
l List references (links) in current document
m Return to main screen
o Set your options
u Upload a file into the current directory

While Lynx is the senior member of the Linux text-based browser club, it's not the only member. The links browser is another, and w3m makes three.

Click Here!