Command line web browser: internet search from BASH terminal
By Russell Barnes. Posted

Access a browser and search the internet from the command line
Advertisement
Starter electronics: how to build and program circuits with a Raspberry Pi or Raspberry Pi Pico.
Most people aren't aware that you can access a command line web browser and search the internet from the text-based shell.
At first glance, a command line web browser doesn't make much sense. One of the advantages when using a desktop interface, like Raspbian, is that a web browser – and a search engine – is just a click away.
This article first appeared in The MagPi 56 and was written by Lucy Hattersley.
Getting online from the command line web browser is a lot easier than you’d imagine. And it's incredibly useful for searching for help, right inside the command line environment. And it's especially useful when you're working on a headless version of Rasbpian (without the PIXEL desktop interface).
There are many different text-based web browsers that enable you to access Google, Bing, DuckDuckGo, and other websites without having to boot into the PIXEL desktop interface.
Set up the ELinks command line web browser
We’re going to use ELinks:
sudo apt-get update && sudo apt-get upgrade sudo apt-get install elinks
Now you can open the web browser from the command line using:
elinks
The elinks interface is a full-screen command line web browser, so it replaces the command line. Press g to open a URL field. You can enter full URLs, such http://www.google.com or just shortened versions, such as raspberrypi.com.
Better yet, there are a few key bindings for helpful sites. Press g then enter these shortcuts:
- d – dict.org search
- sd – Slashdot
- g – Google search
You can also enter Google search terms in the URL field. Press g, then enter ‘g the magpi’ to search for our website in Google.
Other keyboard shortcuts can be used to navigate the program:
- g – Goto URL
- Down Arrow – Next link
- Up Arrow – Previous link
- Return – Select link
- Left Arrow – Back
- u – Forward
- q – Quit
- . – Toggle link numbering
- % – Toggle colours
- t – New tab
- T – Open link in new tab
- > – Next tab
- < – Previous tab
- c – Close tab

Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles

Unusual tools: corner‑cutting shear
The tool that makes cutting corners at work an acceptable practice.
Read more →

‘Friends’ – a Raspberry Pi-powered self‑balancing sculpture
This trio of robots was part of an exhibition called ‘Que Rien Ne Bouge’, which means ‘Let Nothing Move’.
Read more →

Starter Electronics in Raspberry Pi Official Magazine 157
After you’ve built your own simple circuit, why not think a little bit bigger – like building a product, and getting that product verified as officially Powered By Raspberry Pi? We take a look at some of the brilliant gadgets with Raspberry Pi at their heart. If you want to build a submarine, you might […]
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.