Command line web browser: internet search from BASH terminal
By Russell Barnes. Posted
Access a browser and search the internet from the command line
Make beautiful beats with the complete Raspberry Pi music production toolkit.
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
Make Music With Raspberry Pi in Official Raspberry Pi Magazine issue 166
Music production is an esoteric world of chin stroking and arguing over what kind of valve makes the best sound in a guitar amplifier – at least, it can be. Load up on software, bring your friends, and record your latest masterpiece on Raspberry Pi. We bring news from the world of 3D printing, where […]
Read more →
Win one of ten Sixfab AI HAT+
The new add-on could be yours
Read more →
ISS Tracker
Space age is no longer a synonym for futuristic; space age means things that originated in the last millennium.
Read more →