GNOME's file manager, Nautilus, (as you would expect) is much more than just a plain file manager. There are so many configuration options and ways to extend the default GNOME file manager. One way to extend Nautilus is by adding actions. A Nautilus action is a way to add new features that can do pretty much whatever you need it to do. These actions tend to act upon files (either single files or batch files). Actions can call user-created scripts or work with built in utilities.
In this tutorial I am going to introduce you to Nautilus actions by way of the shred command. When this action is used a file is deleted beyond recovery (thanks to the shred command). Once you see how this shred action is created, you can then take that and build upon it to the limits of your imagination.
Before we begin with the action, let me explain a bit about the shred command. Shred does one thing - it overwrites a file to hide its contents and then (optionally) deletes the file. (Of course, for our action, we will be using shred to delete the file.) But why not just delete the file? Simple. A file that has been deleted using the standard means can, with enough work, be recovered. If there is a file you do not want to be able to be recovered, using shred is your best bet.
The basic usage of shred is:
shred [OPTION] file
Now for this action we will be employing a few options:
There will also be one Nautilus Action parameter used:
M: This option sends a space-separated list of the selected file(s) and/or folder(s) to the command used.
Nautilus Action Editor
To open the tool go to the Preferences sub-menu of the System menu and select Nautilus Actions Configuration. When this new window opens (see Figure 1) . From this window click the Add button to create a new action.
The new window that opens will be (for the most part) self explanatory (for our shred example). But this is the information you will fill in:
Figure 2 shows the completed window ready to be OK'd. Once you have completed that information, and clicked OK, you will be back at the Nautilus Actions Configuration window. The only difference will be your new action will be listed in the left pane. You can now close out that window.
Using your new action
All actions are listed in the file manager context menu. In other words, when you right click a file or folder within a Nautilus window, your actions will show up in that menu (see Figure 3).
If I were to now right click on a file (or folder) and select the Shred entry that file would then be shredded. Recovering that shredded file would be quite difficult (if not impossible).
These actions will also show up in the Nautilus Edit menu as well. And remember, you can select multiple files/folders (use the <Ctrl> key when selecting multiple files/folders) and shred them all simultaneously.
These Nautilus Actions can extend your GNOME file manager as far as you can imagine. Give this feature a try and see if you can come up with a cool action to share with your fellow Ghacks readers.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.