Mozilla-based browsers like Firefox have inherited a useful feature from the good old Netscape Navigator: Controlling a running browser instance via the command line. Using command line options, you can open URLs or files inside your browser window without having to enter them in the address bar.
Suppose you’re working in a terminal and want to open an HTML file in your current working directory:
firefox -remote "openurl(file://`pwd`/filename.html)"
Your browser should then open the file in a new tab.
Unfortunately, this is a lot to type, so I wrote a python script called b (for “browser”) which simplifies this. The command above can now be written like this:
Any number of files may be given on the command line. The script supports absolute and relative file names, directories, and URLs. Whitespace and unprintable characters are handled correctly, too.
See the documentation at mozilla.org for more information about the remote control feature.