Two small, useful Nautilus shell scripts

If you use a Unix-family operating system with the Gnome desktop and its default Nautilus file browser, you might know that you can extend Nautilus using simple shell scripts. Here two short and simple scripts.

Terminal window

This script, which I saved in my ~/.gnome2/nautilus-scripts/ directory as Shell, pops up a terminal window already set to the directory you’re browsing. If you want to do anything too complicated for Nautilus (or too tedious to do using a mouse), this is much more convenient than manually opening a shell window and changing the directory you’re already browsing:

#!/bin/sh

/usr/bin/gnome-terminal

Software build

This script, which I saved in my ~/.gnome2/nautilus-scripts/ directory as Make, builds a Makefile-based application inside Gnu Emacs, so that you can easily step through any errors in the source files (it would be easy to modify this to use Apache Ant or something similar):

#!/bin/sh

/usr/bin/emacs --eval '(compile "/usr/bin/make")'

It wouldn’t be too hard to rig up a variant of this to do well-formedness checking and validation of XML documents.

Simple is beautiful

I wasn’t lying when I wrote that these are short and simple scripts — it’s hard to believe how useful they are until you actually use them for a couple of days. It’s possible to do much more elaborate things with Nautilus and shell scripts, including operating on files selected in the GUI window, but as usual in tech, the biggest benefit comes from the lowest-hanging fruit.

Does anyone else have any nice 1- or 2-liners? I assume that KDE‘s file browser has similar functionality, so scripts from there would also be interesting.

About David Megginson

Scholar, tech guy, Canuck, open-source/data/information zealot, urban pedestrian, language geek, tea drinker, pater familias, red tory, amateur musician, private pilot.
This entry was posted in Uncategorized and tagged . Bookmark the permalink.

2 Responses to Two small, useful Nautilus shell scripts

  1. Ross says:

    For the former, you can install the nautilus-open-terminal plugin. This adds it to the top level of the context menu (not in Scripts) and will even ssh to remote machines if you nautilus window is using sftp:.

  2. I wrote a similar Nautilus script a while back to start a terminal in a particular directory. Almost immediately afterwards, I moved to SUSE Linux 10 (Nautilus 2.12.0), which has a “File | Open in Terminal” menu selection to do the same thing. Typical.
    Cheers, Tony.

Comments are closed.