Hire a senior Perl / Python programmer today; download my up-to-date resume (PDF)
John Bokma MexIT
freelance Perl programmer

A Windows start alternative for Ubuntu

Monday, December 1, 2008 | 2 comments

When developing software, mostly Perl programs, on Windows XP I use the command line a lot. And one of the commands I have learned to rely on is start. Now and then I have to open a certain directory in the explorer program, for example to drag and drop a zip file to Thunderbird in order to email it to a customer. And just typing start followed by the directory name does the trick for me. And, no surprise, start . opens the current working directory, and start .. its parent. Moreover, start somefile.txt opens somefile.txt, in my case, in TextPad, and start http://google.com/ opens the URL in a browser, in my case Firefox.

Since I am slowly moving my Perl development to Ubuntu, I was happy to learn that the gnome-open command works similar to start on Windows XP.

Note: a reader, peterix, posted a comment regarding this blog entry recommending to use xdg-open instead of gnome-open since it doesn't rely on Gnome (and is shorter to type).

But since gnome-open is a lot to type, and Perl programmers are lazy, I have added the following alias to my .bashrc file:

alias g='gnome-open'

Which makes g an alias to gnome-open. It might be tempting to use start instead, but start is already a command, see start --help.

If you want to give it a try, open .bashrc in an editor. Via a terminal:

gedit ~/.bashrc

Navigate to the end of the file (Ctrl+End), add the aforementioned line, and save the file (Ctrl+S).

Next, type in a terminal the following to execute the commands in .bashrc:

. .bashrc

Note that the period, followed by a space, in front of .bashrc is short for source followed by space. See help source (not man source, since it's a built in command) for more information on the source command.

You can test the alias for example as follows:

g ~

Which should open your home directory (in my case in Nautilus).


g http://google.com/

Should open the Google search start page in a browser. In my case Firefox. Moreover, if Firefox is already running, a new tab is opened.

Also today

Please post a comment | read 2 comments, latest by John Bokma | RSS feed