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


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

Nui

July 18, 2008
Hmm, this would be more persuasive as an argument with some evidence. I am a happy admin of Windows and a novice user of Linux, so I have taken the ...
Give Linux a chance

Paddy3118

July 18, 2008
Hi, I too work with Electronic Design Automation tools, where Tcl is used extensively. I tend to only occasionally have to write in Tcl and so find the TclTutor utility: ...
Python and TCL

Cliff Wells

July 17, 2008
I personally cannot live without the Web Developer extension or Firebug. Unfortunately these are probably both among the more difficult to port extensions. Given how poorly Firefox functions on Linux ...
Will Epiphany be able to compete with Firefox's extensions?

making money on the internet

July 17, 2008
[url=http://www.divinecaroline.com/public/user/profile?user_id=83997]extra money 101waystoincome.com[/url]
A year after my 2007 predictions - the score card

Leatherjackets99

July 16, 2008
New Style in Leather Jackets For Man and Woman at http://www.Leatherjackets99.com They Offer Free Shipment Worldwide.
Email Syntax Check in Python

Åke Forslund

July 13, 2008
I'm pretty much a novice in both of these languages but I find them both easy to use and preform the tasks I give them. However I rarely use them ...
Python and TCL

Christopher Thoday

July 12, 2008
A single test is not sufficient to give you confidence that the algorithm is working. You should make 'number' an argument of 'main' so that you can test some boundary ...
Python and TCL

paul21

July 10, 2008
Shame on Mozilla. They should make developers specify the extension license before hosting it. They should show the license next to download button as well.
Are your Firefox extensions proprietary software?

Tris

July 8, 2008
Justin - You say they had not heard of Linux? That doesn't sound very professional to me!
Give Linux a chance

michael

July 8, 2008
what about Galeon? in Gnome i use Galeon mostly. it is fast and stable and has a nice portal with search masks for Debian, FSF, Freshmeat and so on. wtf ...
Will Epiphany be able to compete with Firefox's extensions?

vermin

July 7, 2008
> Eventually, after a bit of digging and Googling, I found their Toolbar-License... You simply found the license of the StumbleUpon Toolbar for Internet Explorer. This is another product, much ...
Are your Firefox extensions proprietary software?

Andrew West

July 6, 2008
Both the Python and the Tcl example could do with error checking. While at first this may not seem on topic with the post I think it better shows the ...
Python and TCL

Kurushiyama

June 30, 2008
XML is no replacement for SGML, it's a subset.
An Introduction to ReStructuredText