Command line linking?

by Bob DuCharme

Try this: open up Mozilla's Bookmark Manager (Bookmarks, Manage Bookmarks), right-click a bookmark, and pick Properties. Adding a short string to the Keyword field will let you go directly to that URL by entering that keyword in Mozilla's navigation bar. I had known about this for a while, but hadn't done much more than just play with it—typing "" didn't seem like that much trouble to me.

Then I found out about Mozilla keymarks. Now try this: do a search for a particular word in Google, and then bookmark the result. In the bookmark's properties dialog box, enter "g" as the keyword. Then, in the URL shown in the same dialog box's Location field, replace the search term that you entered with "%s" so that it looks something like this (if you like, just replace the whole URL with what I have here):

Once this is saved, you can enter a Google search query after the "g" keyword and the search will be executed. You can add multi-word searches, quotation marks, and specialized parameters like site:. The following examples all worked just as I expected:

g emacs
g "bob quine" OR "robert quine"
g "dave thomas" -wendy's

Now the Navigation bar feels like a command line to me. I no longer need the one-field form I have on my browser's default home page, which does a Google search. I can jump to the Navigation bar by just pressing ^L, making it even quicker to link this way. And, I've created several new "commands" by assigning the following keywords to the following URLs:

keywordto searchURL
g Google
dict the dictionary
thes the thesaurus
gnews Google news
bbcnews BBC news
imdb Internet Movie Database;nm=on;mx=20;q=%s
imdbname Internet Movie Database (name search);mx=20;q=%s
imdbtitle Internet Movie Database (title search);mx=20;q=%s

Note how the last three keywords all point to roughly the same URL. The last, imdbtitle, searches only movie titles, and imdbname searches only names. (Compare the results of "imdbname ed wood" and "imdbtitle ed wood".) Different keywords do slightly different things there; it's like having different commands to achieve different results.

(As "command line linking" goes, it is possible to add a URL to the command line when you start up Mozilla from the shell, sending the browser right to that URL. In Windows, this opens up a new window each time you do it, and in Linux, it gives you the "Select User Profile" dialog box, both of which I'd rather avoid.)

Now that I think of it, a script that performs a true command-line version of this to retrieve a resource from within a shell would be easy enough to write. It would:

  1. Check the first parameter passed to it, and see whether it was g, imdb, bbcweb, or one of the other keywords it was configured to recognize

  2. Store the remaining parameters in one big string

  3. Map the keyword to the appropriate URL

  4. Substitute the saved string of parameters for the %s in the URL

  5. Call wget or curl with that URL.

Of course, this would pull the retrieved resource to standard out or to a disk file; if you want it displayed in a browser, do the Navigation Bar "command line" trick describ. This scripted wget way, though, can offer some interesting ways to work with RESTful applications, especially if the output really does go to standard out and can be piped to processes that use that data as input.

Has anyone else developed a dependency on this?


2004-08-03 21:42:23
Here are the ones I use
g     Google Search 
gl Google Lucky Search
gp Google Phonebook Search
gi Google Image Search
gn Google News Search
gg Google Groups Search
gq Google Quote Search
gw Google Wikipedia Search
gm Google Microsoft Search
w Google Wikipedia Lucky
wq Google Wikiquote Search
bbc BBC Search
d OneLook Search
dd Search
t Search
dm dmoz Search
p PriceGrabber Search
a Amazon Search
by Search
sf SourceForge Search
sfp SourceForge Project
bz Bugzilla Search
bzf Bugzilla Firefox Search
msdn MSDN Search
ws Wikipedia Search
ext FilExt Search
reg Search
past Wayback Machine Lookup*/http://%s
anon Anonymizer
imdb IMDB Search
ipdb IPDB Search
c .com Shortcut
o .org Shortcut
n .net Shortcut

Note: those last three are less useful in Firefox, since the Ctrl+Enter, Ctrl+Shift+Enter, and Shift+Alt+Enter do the same thing faster now.

Another consideration: keywords with parameters can be used for bookmarklets, too, making the address bar even more like a command-line.
2004-08-04 02:18:32
I use
2004-08-04 02:20:28
I meant to say I use NeedleSearch. (forget a closing quotation
mark in the link markup...)
2004-08-04 03:43:59
Just in case your favourite browser is Safari, check out SafariKeywords .
2004-08-04 07:43:56
Lazy Calculator
I used to use google's new calculator all the time, but opening new tabs become a PITA. So I made myself a bookmark with keyword "expr" that pops up whatever argument i pass directly in an alert.


Anyone know if its possible to write that value to the clipboard?

2004-08-04 17:31:32
command line url in linux without switching profile
"(As 'command line linking' goes, it is possible to add a URL to the command line when you start up Mozilla from the shell, sending the browser right to that URL. In Windows, this opens up a new window each time you do it, and in Linux, it gives you the "Select User Profile" dialog box, both of which I'd rather avoid.)"

I recently grabbed a great applet for GNOME call MailNotification ( which will check the status of your gmail inbox. I yearned to have gmail open in a new window if firefox was not already running, or in a new tab if it was. I got halfway there (and to do this without the above mentioned "change profile" dialog). The following command will open gmail in a new tab (without the "change profile" dialog), as long as firefox is already running:

mozilla -a firefox -remote 'openURL(,new-tab)'

Having figured that out, I set my browser preferences in gaim to run this command:

mozilla -a firefox -remote 'openURL(%s,new-tab)'

Again, works to open a new tab as long as firefox is already running.

If anyone can get a single command that will open a new window when no instance is running, and a new tab when there is an instance running, I'd love to hear about it.


(the above command works for firefox 9.1)

2004-08-05 06:34:33
command line url in linux without switching profile
The site provides some scripts for Linux for querying Firefox so it knows whether to run it or use a new tab.

Really useful, and I've used it for a few Firefox versions now (the script has evolved to be a lot cleaner in that time!).

Hope that helps :-)