Command the Web - an ELinks tutorial

25 July 2007

Command-line browsing is not always the best approach; e.g. for flickr or a webcomic, it is the wrong approach of course.

However, for most things command line browsing works well. The system requirements are very low indeed. It is fast and secure; web pages have a consistent look and there are no flashing adverts, pop up windows or other web annoyances.

About ELinks

ELinks is the coolest command line web browser, indeed it is the only command line web browser that is both still actively developed and supports modern web pages. So as they say where I come from, "it is a good thing you like potatoes". You can think of ELinks as the Firefox at the command line, only cooler and more fun.

http://commandline.org.uk/images/posts/apps/elinks.png

Available from all good Linux/BSD package managers (the package name is normally just elinks). Gentoo users will want to look at the USE Flags carefully and enable everything that you are familiar with, you probably do want Javascript, otherwise many webpages will not work as you expect.

You might want to install it now; then this tutorial is rather more fun. You might want to put your xterm or PuTTy window in one part of the screen and this webpage in the other.

You can just type elinks to start the program, you can also add a domain name, for example:

elinks commandline.org.uk

Basic usage tutorial

Once in the program you use the 'g' key to bring up the address bar (i.e. the 'Go' box). Now you can type in where you want to go.

http://commandline.org.uk/images/posts/apps/elinks2.png

Navigation is pretty obvious. The 'home' key takes you to the top, 'end' to the bottom. Page Up and Down do what they say, you can also just whack the space bar to scroll down through a page. Hit the right cursor key (or Enter) on a hyperlink to follow it, use the left cursor to go backwards. Use the up and down cursor keys to work through the available hyperlinks.

When you want to use a form field or text box, select it with the up and down cursor keys then press Enter to select it for text-entry.

Use the forward slash '/' to search for a word on the page, then use the 'n' key to show the next occurrence.

In rare cases, the webpage might not fit horizontally into your window, in that case use the square brackets [ ] to scroll the page left and right respectively.

Use q to quit and go back to your terminal.

If you haven't already, then you probably want to get used to these basic commands first. When you are comfortable with the interface, then try to use some of the more advanced features outlined below.

Incidentally, if you know Emacs keybindings, many of the basic Emacs movement and navigation commands work in ELinks also. If you want to use a mouse for cut and paste, you need to hold down shift while you select text.

Basic Commands

g - go to URL (bring up address bar)

Home - go to top of page

End - go to bottom of page

Left - go back

Right - follow hyperlink

Up - previous hyperlink

Down - next hyperlink

/ - search

n - next occurrence

[ - scroll window left

] - scroll window right

q - quit

More Commands

d - download hyperlink

ctrl r - refresh

- view HTML

s - bookmarks

h - history

o - options (i.e. browser preferences)

Tabbed Browsing

c close tab

t Open new blank tab

T Open link as tab

< > Move to left/right tab

Alt < Alt > Move tab lef /right

http://commandline.org.uk/images/posts/apps/elinks3.png

URL Shortcuts

ELinks has a URL shortcut feature, you can type special keywords into the 'Go' box (i.e. the address bar) and it will resolve them into URLs. You can define your own shortcuts to your favourite sites, but there are also a number pre-included.

Depending on how the shortcut has been set up, you either type the keyword shortcut alone or you type the keyword shortcut with extra terms (sometimes both). In this latter case, you can type one or extra terms which will be sent as form data in the get request, the significance of these extra terms will vary according to the context.

That last sentence was a long way of saying that you can type 'g fish' and it will search Google for 'fish'.

I decided to contrentrate on these dynamic shortcuts, so in all of the keyword shortcuts featured below, you can at least do it with the keywords, sometimes the keywords are optional.

Top Three Shortcuts

The podium places go to:

g - search google

wiki - lookup a term in the wikipedia

sd - slashdot - popular technical news site

http://commandline.org.uk/images/posts/apps/elinks4.jpg

Dictionaries

There are three dictionaries, and two thesauri.

cambridge - Cambridge Advanced Learner's Dictionary

d - The Collaborative International Dictionary of English

dict - dictionary.reference.com

mw - Merriam-Webster

mwt - Merriam-Webster Thesaurus

thes - thesaurus.reference.com

Open Source software

All the following shortcuts will help you find free and open source software:

dpkg - debian packages

fm - freshmeat

fsd - fsf directory

savannah - Savannah

sf - Sourceforge

More Search

dmoz - open directory

imdb - film search

g - google search

gn - google news

gr - google groups (aka Usenet)

Geeky links

py - Python Documentation

whatis - server uptime etc

vhtml - w3 validator html

vcss - w3 validator css

emacs - emacs Wiki

More Shortcuts

That is enough to give you an idea of the power of elinks' shortcut feature. Other miscellaneous shortcuts include:

bb - use the babelfish translator

arc - use the Internet archive web archive to look up past versions of pages, very useful when you find that you have followed a dead link.

http://commandline.org.uk/images/posts/apps/elinks5.png

Adding a new shortcut

Let's add a new shortcut.

  • Press the 'o' key to open the options window.
  • Scroll down to Protocols and hit space to expand the category.
  • Scroll down to URI rewriting and hit space to expand the category.
  • Scroll down to Dumb Prefixes and hit space to expand the category.
  • Press the right cursor key and select 'Add', press enter.
  • Type clw
  • Press the Enter key
  • Use your cursor keys again to select 'Edit', press enter.
  • Type or paste into the box the following URL: http://commandline.org.uk/#warrior
  • Select Save, press enter
  • Select Close, press enter

Now from the main ELinks window, you can press the 'g' key, type 'clw' and be back here!

Well that's all for now, in a future post I will look at scripting ELinks. Do let me know how you got on using the comments below. Enjoy the command-line web. Surf's Up!

http://commandline.org.uk/images/posts/apps/elinks6.png

1 Bug says...

I'm fine with w3m. Thanks.

Posted at 7:10 a.m. on July 25, 2007


2 Phill says...

Hmmm, I've always found text-based browsing to be a little tedious - especially if you have a website like mine (i.e., loads of links appearing at the top before you get to the actual content).

Very useful, though, if you want to browse the web over SSH (which you have to do sometimes, i.e. if you're logging into a work PC via SSH and you want to do something via a web-based control panel...)

Posted at 8:10 a.m. on July 25, 2007


3 anonymous says...

I find the way you can navigate in lynx very enjoyable (I'm sure it's the same model for elinks). After getting used to INS and DEL for scrolling (I don't see these keys in your tutorial?) I immediately mapped them in vim. (Because you've got to have something between line-by-line scrolling and page scrolling (on a single key!))

Posted at 9:49 a.m. on July 25, 2007


4 Tami says...

Thank you very much for yet another splendid tutorial which enriched my modest collection of "cheat-sheets"(together with shortcuts for vim, bash and emacs) ;). Being a fan of simple tools I let myself to add one more tip: to import your bookmarks from fi. Firefox to Elinks either convert the format from .html to .xbel using CLI(xbel_parse ?) or go to http://www.linkagogo.com/ where you can convert your bookmarks online and then move the bookmarks.xbel file into your .elinks directory. I'm looking forward to your next tutorials and once again many thanks from grateful reader,

tami

Posted at 10:49 a.m. on July 25, 2007


5 d says...

You missed the one key that actually makes elinks usable: . Yes, the period key. It turns on link numbers next to each link, so it makes it really easy to jump to links. Simply type the number and then enter and you jump to that link

Posted at 5:18 p.m. on July 25, 2007


6 Brian Wisti says...

Good stuff! I've been using elinks for a little while, but had never really delved into it. Never even bothered to learn the shortcuts. Found you from a random google search for elinks, and now I'll be using those shortcuts all the time. Thanks for taking the time to post.

Posted at 10:28 a.m. on January 28, 2008


7 Mike says...

Can you tell me where you got the background image with the girl please.

Posted at 8:56 a.m. on May 13, 2008


8 Mike says...

Please tell me where you got the background image with the girl please.

Posted at 9:50 a.m. on July 1, 2008


9 Joe says...

Now - thanks to this article - I just type "links markets" and I have instant world wide market listings - good thing I work on the first floor ;-)

Posted at 10:22 a.m. on October 29, 2008


10 Bassam essa says...

thanx man i need to know how i can download html source page from elinks ? i try $ elinks - view HTML "http://www.google.com/" > resulthtml.txt but its dont work :( thanx again

Posted at 2:55 p.m. on December 25, 2008


11 Bassam essa says...

i try this line command elinks -source "http://www.e51g.com/" > resulthtml.txt

its work done :) thx

Posted at 3:09 p.m. on December 25, 2008


What do you have to say?

Show Editing Help

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Cupcake

July 31, 2010
Good post! You helped me a lot with my school project! CountryField(blank = True) < (K)
Countries in Django

LeshaShampoo

July 30, 2010
it was very interesting to read commandline.org.uk I want to quote your post in my blog. It can? And you et an account on Twitter?
Email Syntax Check in Python

vemma2018

July 30, 2010
I find myself coming to your blog more and more often to the point where my visits are almost daily now!
On Comment Spam

layecenda

July 30, 2010
Hello. And Bye.test :) http://idfjhvihdfiphvlajbvhalibv.com
PuTTY Series: Adding PuTTY to your system path

scuba

July 30, 2010
I’ve been visiting your blog for a while now and I always find a gem in your new posts. Thanks for sharing.
On Comment Spam

Businesking

July 30, 2010
Great site and articles for hack for win, I said Amazing post
How not to program WSGI

Tehnoking

July 30, 2010
This is Great post to learn about the hack Thumbs-up for you :D
How not to program WSGI

Syabiltech

July 30, 2010
I think this articles for master...because very hard to learning, As blogger beginners like me.
How not to program WSGI

coffeeatea

July 30, 2010
Are you looking for coffee gifts? We can tell you more about the coffee gifts including coffee machines and coffee pods.
Introducing Soturi - yet another Django blog application

noni juice

July 30, 2010
I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.
On Comment Spam

Dion Moult

July 29, 2010
What I do know is that ever since I tried out Opera and put their tab bar on the left as a column, I've loved that layout. Back on Firefox ...
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

ZonaEntertainment

July 29, 2010
Wow useful articles, I'm read to learn about this and now I bookmark this to my Facebook, thanks for share!
How not to program WSGI

Giacomo

July 29, 2010
Honestly, I think both Mozilla and you are wrong :) This sort of concept adds overhead. A user would have to manage all this crap, constantly dragging and dropping, creating ...
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

Matija "hook" Šuklje

July 29, 2010
As a minimalist, you'll probybly moan if I mention KDE, but I'll do so anyway ;) The future I want (and actually see slowly fold out before me) is to ...
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

tahitian noni

July 28, 2010
Thank You For This Blog, was added to my bookmarks.
On Comment Spam

Rick

July 28, 2010
I already have piles. It's called A New Window.
We need a thoughout integration of the desktop and the web - not Tab Candy superfast jellyfish

Tech News

July 25, 2010
Thanks for this short tutorial...was auto-FTPing my files from my appserver to webserver for my tech news website. Everything was OK until someone hacked it. Hosting provider is now recommending ...
SFTP in Python: Really Simple SSH

naypalm

July 24, 2010
During the past 3-4 years, I and many others have enjoyed unlimited 2G/3G internet. But ever since the massive cult-like following of i Phone users in the US, most cellular ...
Calling time on mobile internet nonsense?

Steve

July 15, 2010
Very occasionally, you will run into a Java program that uses a lot of memory just to hold all the classes used. It turns out that the JVM uses a ...
Three classic command line tips

no

July 14, 2010
1. number one 2. number two 4. number four 3. number three 6. number six # first # second ## second-ay ## second-bee ### second-bee-one ### second-bee-two
An Introduction to ReStructuredText