YubNub: A command line for the Web

324

Author: Mayank Sharma

Tired of dragging your mouse from one Web site to another, trying to get to the best of the Web? Give YubNub a run. Its name means “hooray” in Ewok, and it might just make you jump for joy. Its developer, Jon Aquino, calls YubNub the URL command line of the Web OS. It provides a portal to hundreds of searchable Web sites.

YubNub can get information by using any Web service. YubNub can search Wikipedia, hunt down the closest pizza place using Google Maps, help you find the latest posts on a particular subject using Technorati, translate pages into English, generate tiny URLs, and perform calculations.

The YubNub home page looks a lot like Google, with a one-line text box in the middle. But unlike traditional search engines, queries in YubNub have a command prefixed, which specifies what needs to be done with the query. So if you want to search for FreeBSD on Wikipedia, enter wp freebsd at the YubNub command line. tec freebsd will get you all the latest posts on FreeBSD through Technorati. And if you need screenshots, try flk freebsd, which looks through Flickr, or try gim freebsd, which looks through Google Images.

YubNub has more than 500 commands. Typing ls in its text box gives you a list of all commands, and typing man command-name gives you the man page of that command. But it’s better to check out YubNub Golden Eggs for a list of interesting commands. The site also has a list of most-used commands.

Aquino says anyone can extend YubNub. “If a new search engine comes out, you can add it to YubNub in seconds on the Create page.” For example, let’s create a command to search for articles on NewsForge. Go to the Create command page and type in the name of the command. Let’s use nforge. Next, enter the URL that searches the site — the Search facility on NewsForge. So the URL in this case would be http://www.newsforge.com/search.pl?query=%s. That’s about it. Make sure to test the command and enter a usage description before pressing the Create My Command! button.

Another interesting feature of YubNub is its support for a limited form of piping (small snippets of text), which made possible the ifThen and if commands that users wrote. For example, we could enhance the nforge command above using ifThen so that when users type nforge without any strings, it takes them to newsforge.com, whereas if they type nforge linux, it searches NewsForge for “linux”. It would look like this: http://www.newsforge.com{ifThen -value1 %s -value2 -test NOTEQUAL -then /search.pl?query=%s}.

YubNub began life as an entry to the Rails Day 24-hour programming contest in early 2005 (eventually winning second place). The Ruby on Rails source code of YubNub is available under the MIT License. Aquino says the code is pretty mature and doesn’t change much these days, other than occasional documentation tweaks.

Instead of using YubNub through the command line at yubnub.org, you can integrate it into your desktop and applications. There’s a Firefox search plugin, a bash script to integrate YubNub into the command line, and a GreaseMonkey script that adds YubNub to Google. You can also use it with emacs. Check out the Installing YubNub page for ways to use YubNub.

YubNub resembles Yahoo! Open Shortcuts, which is currently in beta. On the YubNub blog, you can find a couple of entries on integrating it with Open Shortcuts.

Although YubNub’s commands might take some getting used to, after you take to it, it will save you a few clicks and a noticeable amount of energy.