Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use catdoc to preview Word documents from the command line. Is there something similar for HTML?

In other words I would like to do cathtml Webpage.html | less and get more or less a man page look output.

share|improve this question
up vote 7 down vote accepted

You can use html2text to look into an HTML document from command line.

sudo apt-get install html2text
html2text Webpage.html | less

but not exactly a look similar to man pages, it depends on the html input, of course.

share|improve this answer

You could use w3m which should already installed - if however it isn't

sudo apt-get install w3m

An example command syntax:

w3m -dump | less

It can be used with both URL's as well as file-based html files

w3m -dump index.html | less

enter image description here

share|improve this answer

There are these so-called text html browsers, of which I have successfully tested Lynks and eLinks. Of which elinks has became my favorite.

Anyway, they are different than a "web page previewers" as you suggest in your question. They are more like active real time browsers, which carries on lots of useful features for an easy web browsing and of course, you can also use it for local/remote web pages preview.

Information about Lynks is in the wikipedia and can be reached clicking here. The information related to the elinks is here.

My elinks screenshot for you to see elinks in action:

enter image description here

share|improve this answer
Nice! Looks very good indeed. – Luis Alvarado Aug 24 '11 at 4:02
Ah - so obvious! After I wrote this question I used w3m, that solved it. – isomorphismes Sep 2 '11 at 5:46

One solution is to use lynx -dump, as in

lynx -dump file.html


echo "<div>this is a div</div>" | lynx -dump -stdin


Use w3m -dump, it respects the page layout. It is awesome.

sudo aptitude install w3m
w3m -dump file.html
echo "<div>x</div>" | w3m -dump -T text/html

You can set the number of columns of the terminal for getting the better layout, for example, if you are using a full-window terminal, 200 can be a good try:

w3m -dump -cols 200 file.html
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.