Linux.com

Feature

CLI Magic: Lynx

By Joe Barr on January 31, 2005 (8:00:00 AM)

Share    Print    Comments   

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:

lynx

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 Linux.com as she is seen by a Lynx user. Enter this:

lynx linux.com

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 "linux.com", then Linux.com 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.

Lynx browser
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.

Share    Print    Comments   

Comments

on CLI Magic: Lynx

Note: Comments are owned by the poster. We are not responsible for their content.

Re:Link to your older article

Posted by: Anonymous Coward on February 01, 2005 10:38 PM
I agree. I quit using lynx well over 5 years ago, but I do use some hacked up version of links very regularly.

Lynx does not render many pages correctly and does not support CSS/javascript (some versions of links do, and even support mouse input inside a terminal!).

It is a beautiful thing to be able to ssh into a server, and download updates, patches, new versions, etc. quickly and easily. Also, rendering performance and the fact that the server has at least a T3 makes browsing the web unbelievably and refreshingly fast. Furthermore, because of the rendering performance, it makes my 200MHz laptop seem brand new.

#

Jailed for using Lynx

Posted by: Anonymous Coward on February 01, 2005 10:39 PM

But beware of the terminally ignorant

Posted by: Anonymous Coward on February 01, 2005 11:21 PM
See this posting and make sure your door is not only locked and bolted<nobr> <wbr></nobr>....


<A HREF="http://www.boingboing.net/2005/01/27/jailed_for_using_a_n.html" title="boingboing.net">http://www.boingboing.net/2005/01/27/jailed_for_u<nobr>s<wbr></nobr> ing_a_n.html</a boingboing.net>


Makes you want to weep


Robert

#

Re:Lynx as a serious tool and Blynx

Posted by: Anonymous Coward on February 02, 2005 02:59 AM
And there is Blynx, settings for Blind users
which works very well for fast navigation and
the print-to-mail option listing all the links
on the page, after the page.


  Linkname: Blynx

                URL: http://leb.net/blinux/blynx/

All my lynxen are set up to Blynx settings and
peoplw are shocked that I can "see" and analyze
a pages underlying structure so well.

I am not visually impaired, but any tool for
the handicapped makes this a better world for
the abled.

#

Very handy on servers w/ no X11

Posted by: Anonymous Coward on February 02, 2005 03:21 AM
Unless I'm directly ordered not to, I make it a point to put GNU/Linux or *BSD on any servers that I stand up. I tend to run my servers with no X11 running whenever practicable.

Sometimes I need to download some source code and compile it, and the FTP site, if there's one at all, is already maxed out on connections. I simply fire up Lynx and download my source code. It works in CLI environments, is fast, and gets the job done.

And yep, I've been known to use Links to do the same stuff when Lynx was not installed. They both work well for my needs, and I'll happily use either. I simply have been using Lynx for longer (and again, it does what I need), so I usually run that one first simply out of habit.<nobr> <wbr></nobr>:-)

#

Indispensible on production servers

Posted by: Anonymous Coward on February 24, 2005 04:42 AM
I don't know where ya'll work, but over here, the big iron production servers are all behind a firewall, and none of them have X11 installed. So, for doing things like maintenance, downloading patches, and general utility, lynx is absolutely indispensable.

#

Lynx as a serious tool

Posted by: Administrator on February 01, 2005 01:58 AM
I find lynx to be an indisposable tool for doing some web development [somewhat mitigated by LiveHTTPHeaders, but it's still very useful on any machines that don't have that]
<TT>lynx -mime_headers http://icculus.org/~chunky/</TT>
And it shows you all the http headers being sent down to you [plus source].
<TT>lynx -dump http://icculus.org/~chunky/</TT>
Show a pre-rendered-to-text version of a webpage.

Lynx also has vi keybindings if you so choose [don't forget to also use the -tla option<nobr> <wbr></nobr>:-)]. My entire desktop is based on vi keybindings, and it's nice for a browser to do the same.

I use mutt, and in my<nobr> <wbr></nobr>.mailcap I have this:
<TT>text/html;<nobr> <wbr></nobr>/usr/bin/lynx -dump -force_html '%s';copiousoutput;description=HTML;nametemplate=<nobr>%<wbr></nobr> s.html
text/html;<nobr> <wbr></nobr>/usr/bin/lynx -force_html '%s';needsterminal;description=HTML;nametemplate=<nobr>%<wbr></nobr> s.html</TT>
Which lets mutt automatically render html. Then put this in your<nobr> <wbr></nobr>.muttrc:
<TT>alternative_order text/plain text/html
auto_view text/html</TT>
And all those irritating people-who-only-send-html problems go away.

Gary (-;

#

Re:Link to your older article

Posted by: Joe Barr on February 01, 2005 02:46 AM
I will never, under any circumstances, admit to the fact that I had forgotten I had written about Lynx previously.


They say memory is the second thing to go. I can't recall the first.

#

Link to your older article

Posted by: Administrator on January 31, 2005 10:04 PM
I'm surprised you didn't mentionn <A HREF="http://docs.linux.com/article.pl?sid=04/06/13/1614249&tid=89&tid=14" title="linux.com">this</a linux.com>.

I still love elinks. Others may like like links, links2, hacked links, w3m, or others.

These all make lynx look a little old (and, indeed, links or links2 is often included in distros by default instead of lynx). If you'd like to view a single image on the CLI, use zgv.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya