Book HomeLearning UnixSearch this book

6.3. Lynx, a Text-based Web Browser

In a window system, you can choose from lots of graphical web browsers: Netscape, Opera, KDE's Konqueror, the browser in StarOffice, and more. If you have a window system, try the various Unix browsers to find one you like. Those browsers don't work without a window system, though. They also can be slow--especially with flashy, graphics-laden web pages on a slow network.

The Lynx web browser (originally from the University of Kansas, and available on many Unix systems) is different, and has tradeoffs you should know about. It works in terminals (where graphical browsers can't) as well as in terminal windows. Lynx indicates where graphics occur in a page layout; you won't see the graphics, but the bits of text that Lynx uses in their place can clutter the screen. Still, because it doesn't have to download or display those graphics, Lynx is fast, especially over a dialup modem or busy network connection. Sites with complex multicolumn layouts can be hard to follow with Lynx; a good rule is to just page through the screens, looking for the link you want and ignoring the rest. Forms and drop-down lists are a challenge at first--but Lynx always gives you helpful hints for forms and lists, as well as other web page elements, in the third line from the bottom of the screen. With those warts (and others), though, once you get a feel for Lynx you may find yourself choosing to use it--even on a graphical system. Let's take a quick tour.

The Lynx command line syntax is:

lynx "location"

For example, to visit the O'Reilly home page, enter lynx "http://www.oreilly.com" or simply lynx "www.oreilly.com". (It's safest to put quotes around the location because many URLs have special characters that the shell might interpret otherwise.) Figure 6-3 shows a part of the home page.

To move around the Web, Lynx uses your keyboard's arrow keys, space bar, and a set of single-letter commands. The third line from the bottom of a Lynx screen gives you a hint of what you might want to do at the moment. In Figure 6-3, for instance, "press space for next page" means you can see the next screenful of this web page by pressing the space bar (at the bottom edge of your keyboard). Lynx doesn't use a scroll bar; instead, use the space bar to go forward in a page, and use the b command to move back to the previous screenful of the same web page. The bottom two lines of the screen remind you of common commands, and the help system (which you get by typing h) has the rest.

Figure 6-3

Figure 6-3. Lynx display

The links (which you would click on if you were using a graphical web browser) are highlighted. One of those links is the currently selected link, which you can think of as the link where your cursor sits. On a monochrome terminal, links are boldfaced and the selected link (in Figure 6-3, that's the first "Essential SNMP") is in reverse video. Emphasized text is also boldfaced on monochrome terminals, but you won't be able to select it as you move through the links on the page. On a color terminal, links are blue, the selected link is red, and emphasized text is pink.

When you first view a screen, the link nearest the top is selected. Figure 6-4 shows what you can do at a selected link. To select a later link (farther down the page), press the down-arrow key. The up-arrow key selects the previous link (farther up the page). Once you've selected a link you want to visit, press the right-arrow key to follow that link; the new page appears. Go back to the previous page by pressing the left-arrow key (from any selected link; it doesn't matter which one).

Figure 6-4

Figure 6-4. Lynx link navigation with the arrow keys

Although Lynx can't display graphics in a terminal (no program can!), it will let you download links that point to graphical files--such as the last link in Figure 6-3, for instance, Then you can use other Unix programs--such as gimp or xv (for graphics), and acroread (for PDF documents)--to view or print those files.

There's much more to Lynx; type H for an overview. Lynx command-line options let you configure almost everything. For a list of options, type man lynx (see Section 8.1 in Chapter 8) or use:

$ lynx -help | less



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.