Browsing the web in text form
Tue 13 Aug 2019
There are more browsers like Lynx. Yet Lynx does the best job of rendering and highlighting the relevant elements on a web page in my humble opinion. It also tries to keep the global layout of the content the same and does a pretty good job at it.
Why use text-based browsers?
It is always good to flex our brain muscles. Get used to the tools of the trade even when you don't necessarily need them every day. Text-based browsers are awesome when you freshly installed a distro, not having a DE yet and still need the Internet to look up some information.
Or how about visiting your websites with a text-based browser to evaluate the accessibility of your website. Every website should be traversable on its internal links alone.
What if you don't trust the website? Use Lynx for this and inspect their cookies before accepting them. Lynx does a great job asking if you want to accept each cookie before taking it in use. It doesn't automatically assume you want everything in your cookie jar. Lynx is packed with features that protect it's users from most tracking scripts and removes most fluff that you don't need to ensure a quick and distraction-free experience.
How to use Lynx?
The simplest way is just enter the website right after the command.
# Run in default mode rob@Rathalos ~ $ lynx https://thoughtforcoding.com # Accept all cookies if you trust the website rob@Rathalos ~ $ lynx https://thoughtforcoding.com --accept-all-cookies # Run in "secure mode" to ensure everything over SSL rob@Rathalos ~ $ lynx https://thoughtforcoding.com --force-secure # Use Realm to stay within the given domain to prevent outbound links rob@Rathalos ~ $ lynx https://thoughtforcoding.com --realm # Keep track of your session rob@Rathalos ~ $ lynx https://thoughtforcoding.com --session=./lynx_session
Then there are some options that you might find useful like
--number-links to put a counted index in front of each link or
--force-secure to make sure that all resources and cookies you download are transferred securely over SSL. Another great one is
--realm that will only allow URLs within the domain given to Lynx for that particular session. Want to inspect headers? Use
--head to send a HEAD request and get the headers of the given URL. You can also persist your sessions through a file with
These are just a few examples of what you can do with this wonderful text-based browser. Consult the man page for all options and see what you need. Visit my Useful command line snippets page if you want more examples of useful commands.
Browsh vs Lynx
There is also a "text-based" browser called Browsh. It will even render images in text or even (Youtube) videos... However, I explicitly did not include Browsh into this article as most of the processing is done by Firefox in headless mode.
You end up downloading images, videos, and all other content as you would regularly, not saving any bandwidth. This, and for this reason alone it simply cannot compete nor support the same type of options that Lynx does. They are dependant on the options that Firefox allows them to use and therefore it has no valid reason to be in my toolbox.
It's also not considered lightweight as it depends on the firefox or the firefox-esr package. Firefox comes around ~48Mb in download size and ~18Mb when installed. Browsh itself is also around four times bigger than Lynx when installed.
For that reason, it will not beat Lynx when it comes to this, yet it's a fun browser for sure and do check it out!
Give it a go
Take Lynx for a spin. It's lightweight, fast and might help you out one day. I think it's a great piece of software that could've helped me if I knew about it sooner. That's it for today!