Blog: lynx

Lynx Configuration Five Ways

When it comes to terminal based web browsers I only know of two that are actively maintained. Today I am going to write about one of those, Lynx. Lynx can be very frustrating to the new user or maybe it was just me. What I found frustrating about Lynx was how to configure it. Lynx actually is not hard to configure once you know that Lynx has five different methods to configure it with some of the methods overlapping but many options being unique to a method. None of the methods are difficult to do. It just knowing that different things are configured in different places. I am not going to show you how to configure Lynx but what the five configuration methods are and where to find more information about them in the manual.

The five methods are:

  • lynx.cfg

  • .lynxrc

  • lynx.lss

  • Command Line options

  • Environment Variables

Lets summarize at each method.

.lynxrc

The .lynxrc configuration file holds the options found in the Options menu that can saved from session to session. Remember not all options can be saved from session to sessions using the Options menu. More information about the Options Menu and .lynxrc can be found here

lynx.cfg

The lynx.cfg configuration holds most of the other configurations for Lynx such as the start page and the index page. When you install Lynx depending on your distribution there may only be a system wide lynx.cfg. I would suggest copying the file to your home directory and then customizing the file to fit your needs. Details of the lynx.cfg file can be found here

lynx.lss

The lynx.lss configuration file holds the style settings for Lynx, such as color. Again, when you install Lynx depending on your distribution there may only be a system wide lynx.lss. I would suggest copying the file to your home directory and then customizing the file to fit your needs. The best way to learn about lynx.lss is just play with the file. If you break it just copy it again from the system wide file.

Environment Variables

You can set environment variables for Lynx so it knows where to look for items as it starts up. For example, Lynx looks it the root of the user's home directory for lynx.cfg and lynx.lss but lets say you want to follow the current standard of putting configuration files in the /home/user/.config/lynx directory. You can set add environment variables to change that path in your .zshenv file so Lynx looks for the configuration files in a different location.

An example being:

export LYNX_CFG=/home/yourusename/.config/lynx/lynx.cfg
export LYNX_LSS=/home/yourusername/.config/lynx/lynx.lss

More information can be found here

Lynx command line

If you want to start Lynx with certain options set that can not be set by one of the configuration files or you want to just change something for one session Lynx has many different command line options.

The two I use the most -useragent= and -cookies. The -useragent= flag lets me set user agent string whatever I want. Usually I change it from lynx to l_y_n_x so that I can go to sites that usually block the Lynx browser.

I also use -cookies if I want cookies set to ignore.

More information can be found here

Gotchas

There are a few gotchas in Lynx that makes configuration difficult until you know about them.

One is Lynx assumes your bookmark files and cookies files will be in the root of your home directory and prepends the path with /home/yourusername/ for paths listed in your .lynxrc file.

For example, lets say you want to you want to put the bookmarks file in your .local/share/lynx directory. In the .lynxrc file you would only put bookmark_file=.local/share/lynx/lynx_bookmarks.html Lynx will prepend the path with /home/username/

Another gotcha is in the Options menu. Any option ending in a (!) can only be changed for that session only using the option menu. A user can change the user agent in the options menu but once you quit Lynx the change is gone.

Hopefully this gives you a simple breakdown of where Lynx looks for different customization information.

Zettelkasten ID lynxconfiguration-2020-07-04-1143