1. Home
  2. Linux
  3. Browse the web from the linux terminal

How to use Lynx to browse the web from the Linux terminal

Ever been using a Linux computer with no desktop environment and need to look something up on Google? It happens! Instead of pulling out your phone, consider using Lynx to browse the web from the terminal.

Install Lynx

The most popular way of browsing the internet in the terminal is with the Lynx web browser. It is entirely a text-based browser and works on Unix-like OSes, as well as the MS-Dos command-line. It’s 26 years old, and is currently the oldest web browser still actively being developed.

While Lynx sounds pointless and old, it’s handy, especially when you’re working on a remote Linux server and don’t have GUI access, and need to download a file.

The Lynx web browser isn’t set up by default on any Linux distribution as far as we know. For this reason, we’ll need to go over how to install it and set it up.

To install the Lynx browser, launch a terminal window and follow the instructions that match your OS.

Ubuntu

Ubuntu is widely considered the most popular Linux distribution, so it makes sense that there is a Lynx package available for installation in the repos. To get it, enter the Apt command below in a terminal window.

sudo apt install lynx

Debian

The Lynx web browser supports a lot of Linux distributions, including Debian Linux. To install it, launch a terminal window and enter the Apt-get command below. Keep in mind though, that Debian updates packages slower than others, so this version of Lynx may be out of date.

Note: want a newer version of Lynx for Debian? Follow our guide here to learn how!

sudo apt-get install lynx

Arch Linux

Arch Linux users are known for their love of the terminal, so it’s not a surprise to see the Lynx browser available in the main software repo. To install it on your Arch machine, enter the Pacman command below.

sudo pacman -S lynx

Fedora

Need to get the Lynx browser working on your Fedora Linux box? Don’t worry! It’s straightforward to install as the Fedora developers provide an easy to install package in OS’s software sources.

To get the browser going, run the Dnf command below.

sudo dnf install lynx

OpenSUSE

Using OpenSUSE and want to browse the web with Lynx? Launch a terminal and install the latest version of Lynx with the Zypper command below.

sudo zypper install lynx

Generic Linux

Lynx is an ancient browser, so it’s likely even the most obscure distro has it in their software sources. Still, if you can’t find it, Lynx can be built from source with the instructions below.

Step 1: Download the Lynx source code.

wget https://invisible-mirror.net/archives/lynx/tarballs/lynx2.8.9rel.1.tar.bz2

Step 2:  Extract the source code.

tar xvjf lynx2.8.9rel.1.tar.bz2

Step 3: Enter the Lynx code directory.

cd lynx2.8.9rel.1/

Step 4: Configure the source code.

./configure --prefix=/usr

Step 5: Compile Lynx.

make

Step 6: Install the Lynx browser to your operating system.

make install-full

Browse the web from the terminal

As the Lynx browser is command-line based, all web pages are opened by specifying the URL ahead of time. For example, if you wanted to visit Wikipedia, you’d launch a terminal and do the following:

lynx https://www.wikipedia.org

When the web page loads, you’ll be bombarded with prompts. These prompts are the product of our modern internet. You’ll need to press “A” to allow cookies (permanently), and it can take a while.

After accepting all of the cookies and prompts that appear on screen, the web browser should render entirely in text-based mode.

Lynx shortcut keys

The Lynx web browser ha quite a lot of keyboard shortcuts. Let’s briefly go over them, as they’ll significantly improve the browsing experience in the terminal.

For starters, if you’d like to navigate away from the website you’re on to a new one, press G on the keyboard. Want to go back a page? Press Left on the keyboard. To follow a link, press the Right arrow key.

Scrolling in the Lynx web browser is similar to a lot of modern browsing applications out on the market today. To navigate down a page, press the Down key on the keyboard. Press Up to move up the page.

Mmore information about Lynx

The Lynx browser is useful but complicated for most users not used to a text-based way of navigating the internet. Thankfully, the program has a detailed manual that outlines every aspect of the browser!

To view the Lynx manual in the terminal on your Linux PC, run the following command:

man lynx

Alternatively, save the manual to a text file for more comfortable reading with the command below.

man lynx >> ~/Documents/lynx-manual.txt

Comments are closed.