This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new!


Extending Nautilus with Scripts and Extensions

By Peter Enseleit on May 16, 2006 (8:00:00 AM)

Share    Print    Comments   

Nautilus, the GNOME file manager, has a host of functionality for browsing and managing file systems, and for accessing remote servers including Windows shares, FTP servers, SSH servers, and WebDAV servers. On top of its built-in capabilities, you can extend the functionality of Nautilus by using Nautilus Scripts and Extensions. It's not too hard to do, and I'll show you how to get started.

Nautilus Scripts

A Nautilus Script is an executable file, written in a scripting language, which can perform some function on files or folders selected from within the Nautilus file manager window.

Linux is rich with scripting languages, including Python, Perl, and Ruby, and has a variety of command line shells to choose from, such as Bash, Zsh, and Csh. Any of these can be used to write a Nautilus Script.

You don't need to know how to write Nautilus Scripts to use them. A search on the Web for Nautilus Scripts will return a number of links to scripts other people have already written and have made available for others to use. G-Scripts is a site that gathers many of these scripts.


Scripts are usually packaged in compressed archives, so, once you've downloaded a script you're interested in, you'll need to extract it using an archiving program such as File Roller for GNOME, or Ark for KDE.

Next, you need to copy the file to the .gnome2/nautilus-scripts folder inside your home folder. The dot in front of the folder name means it is a hidden folder, so you will need to make sure you can see it in Nautilus by selecting Show Hidden Files from the View menu.

Finally, you need to make the script executable. View the properties of the file in Nautilus and, on the Permissions tab, check the Execute checkbox for the owner of the file -- that should be you.

If you prefer to use the command line, open a terminal and navigate to the folder where you downloaded your script, then unpack it with one of the following commands, depending on the file extension of the file you wish to decompress:

tar -zxvf myscript.tgz
tar -zxvf myscript.tar.gz
tar -jxvf myscript.bz2

Copy the script to the nautilus-scripts folder:

cp myscript ~/.gnome2/nautilus-scripts

Change the script's permissions so that it is executable:

chmod u+x myscript

If you want all users on your system to be able to use the script, it should be installed into the /usr/share/nautilus-scripts folder. You'll need to have superuser privileges to copy the script into this folder and change its file permissions.


How do you use a script? From within Nautilus, navigate to a file and select it. Then click it with your right mouse button, and a context menu will appear with a Scripts menu item. You can also open the Scripts menu item from the File menu and, if you are using Nautilus to manage your Desktop, from a right mouse click on the Desktop. This menu item is not visible if no Nautilus Scripts are installed. Expand the Scripts menu item and you should see your script listed. Click it, and the script will perform its actions on the file you have selected. Many scripts allow you to select multiple files at once.

If you're looking for ready-made scripts, see the G-Scripts site. G-Scripts has scripts for archiving files, opening files with particular applications, sending files via email, image manipulation, integration with the Subversion version control system, and package management, to name just a few.

Writing a Nautilus Script

To write a Nautilus Script, you'll need to know at least the basics of your chosen scripting language. A good starting point is to look at how others have written their Nautilus Scripts and get ideas from them.

If you are using an external program in your script, you will also need to find out which command line parameters it accepts. In your script, construct the parameters your external program needs, then call the program, passing it those parameters.

Let's take a look at a simple script, which creates a new email message using the Sylpheed-Claws email client, and includes the files you select in Nautilus as attachments.

Next: A sample script

Share    Print    Comments   


on Extending Nautilus with Scripts and Extensions

Note: Comments are owned by the poster. We are not responsible for their content.

relief joint

Posted by: Anonymous Coward on May 28, 2006 06:11 PM
[URL=] Pain relief [/URL]

  [URL=] Back Pain [/URL]

  [URL=] Pain relief [/URL]
[URL=] Pain relief [/URL]
[URL=<nobr>.<wbr></nobr> htm] Nerve pain relief [/URL]


errata regarding /usr/share/nautilus-scripts

Posted by: Administrator on May 19, 2006 11:08 PM

Installing your script to<nobr> <wbr></nobr>/usr/share/nautilus-scripts will not automatically work for all users.

However, you can make scripts placed in this folder available to users by running nautilus-script-manager, which creates a symbolic link to your script in a user's ~/.gnome2/nautilus-scripts folder.

This only creates the link for the user who runs nautilus-script-manager though.

Steps to allow all new users to be able to use Nautilus Scripts from a global scripts folder:

1) Install your script to<nobr> <wbr></nobr>/usr/share/nautilus-scripts

2) Add a symbolic link to your script in the<nobr> <wbr></nobr>/etc/skel/.gnome2/nautilus-scripts folder.

mkdir<nobr> <wbr></nobr>/etc/skel/.gnome2

mkdir<nobr> <wbr></nobr>/etc/skel/.gnome2/nautilus-scripts

ln -s<nobr> <wbr></nobr>/usr/share/nautilus-scripts/myscript

This way all new users will have a link to your script created when they first login and they can delete the symlink if they don't want it anymore.

Alternatively you could add these lines to your<nobr> <wbr></nobr>/etc/skel/bashrc file:

if [ -x nautilus-script-manager ]

if [ ! -h<nobr> <wbr></nobr>.gnome2/nautilus-scripts/myscript ]

nautilus-script-manager enable myscript



This checks for and creates a symbolic link to your script, if it does not exist in the local user's<nobr> <wbr></nobr>.gnome2/nautilus-scripts folder, each time he logs in.

See man nautilus-script-manager for more info


This story has been archived. Comments can no longer be posted.

Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya