Console Web Browsers
Summary:
- Why Using Console Web Browsers?
- Lynx
- Links
- w3m
Why Using Console Web Browsers?
Even if you spend your Linux time entirely on X and the Window Manager or desktop environment of your choice, there are scenarios where console based web browsers can come in handy:
- If your machine isn't beefy enough to support a graphical web browser.
Graphical web browsers are resource hogs, whereas console based browsers are very lightweight (around one or two MB RAM and almost no CPU usage). - If you don't want or can't use X.
If X isn't working and you can't figure out why, it's good to have browser around which allows to look stuff up in the 'Net. If you're like me and start X from the console, you will likely have encountered the situation that you remember you wanted to look up something on the 'Net just after quitting X. Instead of starting X again, use a console browser. - Console browsers are speed monsters.
Nothing beats a console browser in terms of sheer browsing speed. - Quickly transform HTML to ASCII.
All console browser feature an option to convert HTML files to plain text files from the command line (which means you can pipe the ASCII output to other programs for further processing. - You're writing web pages.
Console browsers mercilessly show you if your page design makes sense without graphics. Keep in mind that some people use console browsers because they are the only way for them to access the 'Net. But it's more than that: If your site makes sense in a console browser, it's a very strong sign that it is well structured. And all your visitors will profit from that.
Lynx
The veteran in this category is the Lynx browser (Mandrake Linux package 'lynx').
The most distinguishing 'feature' at the first glance is that Lynx renders horizontal tables vertical. This can be confusing at first, especially if the webmaster relies on tables only to structure their site. On the other this feature guarantees that all of the page's width will fit in a standard terminal window, so you don't have to scroll sideways.
Like all console based browsers, you usually start Lynx from a terminal with a destination address as the only argument, e.g.
lynx www.slashdot.org
In its default mode, you'll find some essential information on navigating at the bottom of the terminal. The first line of terminal displays the title of the current page you've loaded, of how many terminal pages this page consists and on which of those pages you are. A '<<<' in the left hand upper corner is displayed if there's a page in the history you can go back to by using the 'left arrow' key.
Configuration
There are two system configuration files for Lynx, '/etc/lynx.cfg' and '/etc/lynx.lss'. The latter determines which colors are used for text between certain HTML tags.
'lynx.cfg' is abundantly commented. If you want to change some options, copy that file to your home directory, rename it to '~/.lynxrc' and put that line into your '~/.bash_profile' file:
LYNX_CFG=~/.lynxrc; export LYNX_CFG
Run
source ~/.bash_profile
so that you can start making changes right away instead of having to log out and in again. You'll have to restart Lynx to make changes take effect. This method is recommended because it will also allow you to make permanent configuration changes from within Lynx.
Some Interesting Options
Like every good old Unix program, Lynx can be configured in countless aspects. I've picked some of those options which might be of interest for the everyday user (i.e. which I find worthwhile ;-)).
Notice that you can override these options for a Lynx session by supplying the correct command option. lynx ––help gives you an overview on them.
A further notice on syntax: Lines with '#' in front of them are regarded as comments. Options and their default settings are also commented. In order to change them, you have to remove the '#' in front of them and change the setting (often from TRUE to FALSE or vice versa).
-
USE_MOUSE:TRUE
SCROLLBAR:TRUE
-
COOKIE_ACCEPT_DOMAINS:
COOKIE_REJECT_DOMAINS:
SET_COOKIES
ACCEPT_ALL_COOKIES
Another important cookie related setting isPERSISTENT_COOKIES
-
DEFAULT_KEYPAD_MODE
LINKS_ARE_NUMBERED
-
DEFAULT_USER_MODE
NOVICE
ADVANCED
-
DEFAULT_EDITOR
-
XLOADIMAGE_COMMAND
-
KEYMAP
-
FTP_PASSIVE
Lynx can be used in commandline mode to strip HTML from web pages and convert them into simple text files:
lynx -dump file.html > file.txt
This commands creates a new file 'file.txt' which contains everything from 'file.html' but the HTML markup. Every link found in the HTML file will be replaced by a number and the link referenced under that number at the end of the text file. If you don't want that feature, add the '-nolinks' option.
The detailed program documentation can be accessed from within the program ().
Links
Many regard Links (Mandrake Linux package 'links') as the rightful heir to the Lynx browser. It even adds features like proper display of horizontal tables and frames, limited support for ~JavaScript, drop down menus and the latest version even features a basic graphics mode in X (you'll currently have to compile the source yourself if you want that, though).
You start Links just like Lynx:
links www.slashdot.org
Links is by default mouse aware, although it doesn't seem to be possible to scroll using the mouse yet. Keyboard navigation is much like in Lynx.
Notice that traversing the page using the 'up' and 'down' keys is a bit tedious if the page consists of horizontal tables, since Links will go through the links of the first column, then through the links of second column, then the third and so on. Lynx' 'number links' feature would do wonders here but regrettably isn't implemented. Use instead.
Another problem caused by table display is that some pages are too wide to fit entirely into a standard 80x40 terminal window. In this case you have to scroll side-ways or resize the terminal window. Links uses the keys { and } for that function, w3m, introduced later on, uses <; and >.
Press the key to activate the menu bar (or click on the first terminal line with your mouse) and use the arrow keys to navigate it. Submenus are activated with the key and closed using the key. All configuration happens via these menus, you are not supposed to edit '~/.links/links.cfg' directly, except for the
download_dir directory
Like Lynx, Links has a '-dump' option to convert HTML files to plain text files. Since Links supports horizontal tables, the output usually looks a bit more formatted than with Lynx.
There's also an 'experimental' version of Links, ELinks with improved Cookie handling and some other improvements.
Keybindings are listed in the README file in '/usr/share/doc/links-version', other information can be gathered from man links and the Links User Reference Manual.
w3m
w3m (Mandrake Linux package 'w3m') is a console text pager like 'less' which happens to be a web browser, too. The feature set is comparable to that of Links, although some features currently are only available as patches.
If you want mouse support, you have to compile the source by yourself, since the Mandrake Linux RPM has been compiled without mouse support. Compiling the source yourself will also allow you access to some interesting experimental features of the latest version like the inline display of web graphics.
You start w3m like every other console based browser, e.g. with
w3m www.slashdot.org
Keyboard navigation is a bit different from the defaults in Lynx and Links. The 'up' and 'down' keys do not jump from link to link but show an 'editor-like' behavior, the 'jump' function is performed by TAB. This makes sense because it allows you to move the cursor from table column to table column with the arrow keys and then use TAB to jump to the link you want.
Like Lynx, w3m can execute local CGI without the help of a web server.
w3m's settings are configured via an options page (, leave with ). The keymapping is listed in '/usr/share/doc/w3m-version/doc/keymap.default'. Like in Links, this mapping can't be modified once the program is compiled.
'/usr/share/doc/w3m-version/doc' contains various README files, the w3m Manual, an FAQ and the w3m man page, which you might want to copy to '/usr/share/man/man1' where it belongs.
Related Resources:
Extremely Lynx
man lynx
man links
man w3m
Revision / Modified: July 9, 2002
Author: Tom Berger
Legal: This page is covered by the GNU Free Documentation License. Standard disclaimers of warranty apply. Copyright LSTB and Mandrakesoft.
Version 1.3 last modified by AdminWiki on 22/03/2004 at 09:45
Document data
- Lost account?
- Join the community, be part of the Club: it's free!
- Get the PWP Download Subscription!