Share: Facebook icon - Twitter icon - LinkedIn icon

The joy and wonders of browsing the web from the command line - A short introduction to Lynx

Published Sat Jan 20 2024

Tags: cli linux macosx web-browsers


There is probably no secret that I enjoy using the command line. Modern Graphical User Interfaces (GUIs) feel bloated to me, and I often have the feeling that there are too much bloat on the screen at once. Fortunately, I can do most of my tasks in Emacs or the command line. Yes, even web browsing! Though I have to admit that I end up using graphical browsers to be able to watch YouTube and do some daily things like internet banking. I have briefly mentioned Lynx and terminal web browsing in previous articles, but I have never really showed it in detail. Today is the day we are finally going to look at web browsing from the command line!

If you are curious on where Lynx was mentioned before, and maybe also on keyboard driven web browsing, take a look at my article on Vimium (a browser extension). I also mentioned an alternative to Lynx called browsh in an earlier article, but I have always gotten some sort of error when trying to use it (maybe due to weird dependencies to Firefox). A shame, since I loved the idea of more advanced rendering in the terminal. It can also be a bit too much, as I often try to run away from modern GUIs when doing weird things in the command line… The simplicity and ease of use is often what attracts me to it.

Before I bore you with details, let's take a look at what browsing themkat.net looks like:

Browsing the main page of TheMKat.net with Lynx

Not to bash my own web design skills, or lack thereof, but it is often much more comfortable to read text like this without all the distracting UI elements! It is not always feasible, as images and video can be a big part of the browsing experience. Though if I just want to read text it is perfectly fine. Quickly checking some documentation, reading StackOverflow answers (yes, I read it and I feel like a pleb for not being able to find all information I need from man-pages), etc. is a great fit for quick browsing in Lynx.

Installation

Most package managers already have Lynx available, so simply install with your package manager of choice (e.g, Homebrew, Apt, Dnf, etc.). It is also available for MS DOS and older versions of Windows! Just take a look at the official site to find download links. If you dabble in modern Windows (my condolences), I think the best bet would be to use Windows Subsystem for Linux. That being said; why are you using Windows?!?!

Sadly no version for Amiga systems to my knowledge, though iBrowse is a pretty good graphical browser without too much eyesore.

Basic usage

To start Lynx, you simply type the lynx command. If you know the page you want to browse, you can include it in the command like this:

lynx themkat.net

(I assume you wanted to browse my site :) )

Once you are inside, like in the screenshot above, you see that Lynx has guides at the bottom of the screen to show you the commands to use. In addition to the right-arrow key, you can use Enter to click on things. Navigating to a new page is as simple as pushing the g-key:

Navigating to google.com using Lynx

Lynx also respects your privacy, so before you are taken to a new page, you will be asked to allow or deny cookies if applicable:

Lynx respecting your privacy and asking if you want to allow cookies

What then when we finally come to the Google.com site? What about text fields? Lynx guides you there as well, by stating how you enter the text field and get out of it:

dsfsdf

When you are done browsing, you simply type the q-key and confirm with the y-key (or abort with the n-key if you changed your mind).

Wait… Why would I even use this if I'm not a weird nerd like TheMKat…?

Lynx is obviously an older application, and was most popular when many people used text based user interfaces like MS DOS or Linux without an X server. Most people will probably also think of it as a relic from that time. Some of this shows, as it does not support modern features like video, styling, or JavaScript (the last one being a good thing in a lot of cases). Old and lacking of modern features has never stopped me, as I use what I love no matter what others may want. That being said, there are a few reasons to use it:

  • Logging in to a server using SSH (without X forwarding). You can check something fast on the internet with ease. You can probably use your browser on your client machine in those cases…? I often choose to use Lynx instead for simplicity, and for avoiding the eye sore of modern websites. Not needing to download 15MB of JavaScript also helps…
  • Checking something on the internet without starting X server or any graphical programs. I do this sometimes on machines like Raspberry Pi or other linux boxes. GUIs are often unnecessary if I haven't made it super clear.
  • You have an older computer you want to surf the web on without a graphical user interface. There are many modern solutions to getting older machines online, and using your older machines more instead of always buying new stuff can be a good thing!
  • Getting a different experience than the one you are used to, and broadening your horizons! If I should convince you to try Lynx in 2024, this is probably the best reason. Most people probably find one way of doing things, and keeps doing that forever. Same with their opinions formed in echo chambers. Doing new things broadens your horizons and make you more open minded in the long run.



Other posts that might interest you: