Ubuntu TIP: Automating Package Installation – apt-get to the rescue I Heart Canon
Mar 09
My Sites: My Blog | My Tech Blog | Follow me on Twitter
----

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 (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):

CODE:
  1. #!/bin/bash
  2. gnome-terminal --working-directory="$1"

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

CODE:
  1. 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.

Nautilus_scripts

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

CODE:
  1. sudo killall nautilus

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


----
If you liked this post, then you can Subscribe to my feed
Quote of the day: Trust no one. Question Everything. - Deus Ex

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • blogmarks
  • IndianPad
  • StumbleUpon
  • Technorati
  • Facebook
  • Live
  • Reddit
  • Slashdot
  • YahooMyWeb
  • e-mail

Related posts

written by Shantanu Goel \\ tags: , , , , , , ,

Leave a Reply