Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to write a Nautilus script in Python. Is that possible? If it is possible, how can I do that?

share|improve this question
up vote 17 down vote accepted

Nautilus Scripts

Nautilus scripts can be written in any programming language, including python. You just need to make your python source file executable and copy it to ~/.gnome2/nautilus-scripts. You will probably want to rename it so that it has a descriptive file name, without the '.py' extension. You will also need to add #!/usr/bin/env python as the first line of the file. Once you have done all this, the script will be accessible from the 'Scripts' sub-menu of the right click menu in Nautilus.

nautilus scripts menu

Nautilus Extensions

Nautilus extensions have more flexibility than scripts - eg. they can be used to add an item directly to the context menu. There is are python bindings available (python-nautilus install python-nautilus).

Visit the web page of this library and view the documentation for more information.

share|improve this answer
Note that while the question and answer are specific to Python (and it does work), the same strategy is equally effective for Bash, Perl, Ruby, and other scripting languages so long as the #! points to the right interpreter. – Freedom_Ben Aug 30 '13 at 16:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.