HIW is a series outlining various tools that I use on a daily basis.
urlview is a popular curses program that extracts URLs from an input. The parsed URLs display on a menu from which you can launch a command to view the selected item.
You can configure urlview to open a browser or do almost anything by configuring a custom handler.
echo "website: http://mingle.cm / twitter: http://twitter.com/caleb.io." | urlview
Once the menu is open you can use your arrow keys to select a URL to take action on. You can also type in the number of the URL that you wish to select.
The urlview package should be available via the package manager of your choice.
apt-get install urlview
brew install urlview
See the man page for available configuration options. I haven’t needed to configure urlview as it has sensible defaults. It has worked properly by opening my default browser on Ubuntu and OS X.
Integration with mutt
urlview is great when used with mutt (a great console email client).
Add the following code to your .muttrc and you’ll be able to press Ctrl-u within a message to open urlview.
macro pager \Cu "|/usr/bin/urlview<enter>" "call urlview to open links"