“Open Terminal Here” for Gnome (Nautilus)

When clicking around in the Gnome-based desktop environment, it can often be useful to quickly start a shell in the current directory. Gnome’s file browser (at least for Debian Lenny) is Nautilus. One adds this capability by adding a custom script that can then be made to appear in the context menu (i.e., right-click menu). Here is an explanation and an example script. Script itself shamelessly stolen:

# From Chris Picton
# Replaces a Script by Martin Enlund
# Modified to work with spaces in path by Christophe Combelles

# This script either opens in the current directory,
# or in the selected directory

base="`echo $NAUTILUS_SCRIPT_CURRENT_URI | cut -d'/' -f3- | sed 's/%20/ /g'`"
while [ ! -z "$1" -a ! -d "$base/$1" ]; do shift; done

gnome-terminal --working-directory="$dir"

However, this page gave me the additional insight that scripts added to ~/.gnome2/nautilus-scripts will only become available after navigating to the scripts directory within Nautilus. This strikes me as rather odd, and I am quite amazed that I found an explanation for why my new script wasn’t appearing in only a few minutes with google.


Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s