Not to sound like a Luddite, but sometimes the old ways are best. When it comes to Web browsers, that's not very often, but knowing your way around a text-mode browser like w3m does come in handy from time to time. You probably won't want to switch, but after taking a look at what you can do with w3m, you might want to add it to your toolbox.
Generally, I focus on the cutting edge goodies for the Web, but this week I spent some time with w3m after a long hiatus and thought it might be fun to take a step back and look at the old school Web. I needed to convert a page of HTML to text on the fly, and one of the best tools I’ve found for that is w3m. It’s also a pretty good, if extremely basic, Web browser if all you need to do is read pages on the Web.
Why muck with a text-mode browser? Certainly not because it’s full-featured. Firefox, Chrome, Konqueror, or Opera, any other modern browser will get you more bang for the buck than w3m — though w3m’s rendering speed is pretty impressive. But w3m has a few features that you won’t find in other browsers that make it worth having around.
Checking Site Design
Your site may look picture-perfect in your favorite browser, but what about all the other browsers that you haven’t had time to test? Does it degrade nicely for people on less functional mobile browsers? While the percentage of visitors who hit your site with less-functional browsers may be small, it’s still important to make sure that the site is usable.
Browser of Last Resort
It has happened, albeit rarely, that I needed a way to get online when it wasn’t possible to get to one of the GUI browsers. Either because X was broken, or when working at a server and needing to get to a download without X installed at all. You’ll find w3m comes in very handy indeed when having to browse to a site and grab a file or files from the console.
It doesn’t happen often, but I find about once or twice a year that I need to roll out w3m in a situation where Firefox or other GUI browsers just aren’t available.
Converting HTML to Text
While using w3m for troubleshooting doesn’t come up too often, it’s not uncommon that I need to convert something in HTML to plain text — and I’ve found that w3m is a really handy tool to do so. Even on some complex pages, w3m has been good at converting HTML to usable text.
It’s very easy to do, too. You can try it by running
w3m -dump -T text/html filename.html > filename.txt. If you’re converting an online document, simply replace the filename with the URL.
Where w3m really shines is scripting. Which is to say, if you need a browser that can easily be used from a script, w3m is far superior to Firefox or any other GUI mode browser.
For instance, if you wanted to have a quick and dirty way to monitor a Web site, you could knock up a short script that would call w3m, check the content of the page, and then either exit quietly if all is well, or send a message to the person on-call to make sure that everything is up and running smoothly.
Getting w3m shouldn’t be a problem. You should find w3m as part of the default installs of many Linux distros, and it should certainly be packaged up for all popular major distros these days.
If started without an argument, w3m will just display its help file, so you’ll want to tell w3m what site or file to start with if you’re browsing the Web:
Once you’re in w3m, you’ll need to know a few basic commands to navigate the Web. w3m uses standard Vim movement keys to move around a page, so
l will move the cursor to the right,
k will move up,
j will move down, and
h moves to the left.
To scroll more quickly, hit the
Space bar, and to scroll backwards quickly through a page, hit
b. To go back through your browsing history use the left arrow key or
Tab key will put the cursor on the next hyperlink on the page (if there is one), and
Shift-Tab will move backwards to the next hyperlink.
To follow a link, just hit
Enter when you’re on the link. If you want to type in a URL, type
g and w3m will prompt you for the URL.
If you want to get to w3m’s help, just hit
?, which should be pretty easy to remember.
Found a page you want to bookmark? Type
a to add it to your bookmarks, and
v to view bookmarks.
Finally, to exit w3m hit
q and you’ll be prompted to answer whether you’re sure or not you want to exit. If you want to skip that, hit
Q to skip the prompt.
I wouldn’t want to spend all my time browsing the Web using w3m, but it does prove useful in a pinch.
Joe 'Zonker' Brockmeier
is a freelance writer and editor with more than 10 years covering IT. Formerly the openSUSE Community Manager for Novell, Brockmeier has written for Linux Magazine, Sys Admin, Linux Pro Magazine, IBM developerWorks, Linux.com, CIO.com, Linux Weekly News, ZDNet, and many other publications. You can reach Zonker at
firstname.lastname@example.org and follow him on Twitter