Ubuntu TIP: Extending Nautilus, Scripting Your Way To UI Bliss

I'm back from my vacation and this is a smallish post before we return to our regular programming (I'm full of puns ).

Rahul (my friend and guest author on this blog) introduced me to an old-but-useful trick a few days ago that I didn't know about. It's about customizing nautilus to display a context menu that has a few of your chosen scripts to weave their magic on the selected object. And the procedure to do this is summarized in just two steps:

  1. Write your script.

  2. Save it in ~/.gnome2/nautilus-scripts and make it executable

Of course, if you don't know scripting the first step itself is quite daunting, but you can get a lot of pre-cooked scripts on the internet by searching for “nautilus scripts". e.g. take a look at g-scripts homepage.

To get you started immediately, here is a crude example to open a terminal/console window in any folder/path through right-click menu:

Step 1) Write your script (any scripting language: shell, perl, python, etc):

Step 2) Save it in ~/.gnome2/nautilus-scripts, name it as “Terminal” and make it executable.

Step 3) Now, you should see a “Scripts” option in your right-click menu as shown below. Clicking on “Terminal” will open a new terminal window with the present working directory being set to the selected folder.


Note: If you don't see the “scripts” menu option (or your script name in the extended menu), then just run

Let me know if you face any problems with this or have any other questions.

See also