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:
- Write your script.
- Save it in ~/.gnome2/nautilus-scripts and make it executable (chmod +x <script name>).
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):
#!/bin/bash gnome-terminal --working-directory="$1"
Step 2) Save it in ~/.gnome2/nautilus-scripts, name it as “Terminal” and make it executable.
chmod +x Terminal
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
sudo killall nautilus
Let me know if you face any problems with this or have any other questions.
[tags]ubuntu, tip, nautilus-scripts, nautilus scripts, g-scripts, gscripts, shell script, nautilus, terminal[/tags]