Commands on the context menu can make our lives easier within any operating system. Linux Mint and Ubuntu already have some important right-click commands in Nemo and Nautilus respectively. If, however, we wish for more, here's how to add extra right-click commands to our Linux distribution.
We have prepared this guide on Ubuntu 15.04 and Linux Mint Cinnamon 17.2. It should work on other distributions, provided they use Nemo or Nautilus as a file manager.
How to add right-click commands in Ubuntu
To add right-click commands in Ubuntu, we need to install the nautilus-actions application.
We can search for it at the software center, or open a terminal with Ctrl+Alt+T and type:
sudo apt-get install nautilus-actions -y
After the installation finishes, without any error messages, we will find Nautilus actions at the Unity Dash.
To create a new action, we click on the new action button and fill in the Context label field with the name we want portrayed on the right-click context menu.
For the example, we will create a right-click command that enqueues audio files to Rhythmbox.
On the Command tab, we write the full path to the application and add the proper parameters.
To find all the possible parameters for a program, we just need to open a terminal and type:
This command will show the manual of the application, that contains all the possible parameters we can pass to it.
Apart from the program's parameters, we should also consult the Nautilus-Actions parameter Legend, which will provide the correct syntax for file and folder related parameters.
On the Basenames tab, we select the basename filter, so that this particular right-click command will only show for the correct file types. For the example, we will need the "Enqueue in Rhythmbox" command only for audio files, namely .mp3, .flac, and .ogg. You can add more, if you want, separating them with ";".
We should also uncheck the "Match case" box, in case we have files with a ".Mp3" or ".MP3" extension.
On the Mimetypes tab, we select "audio/*" as the Mimetype filter.
With that, our right-click command is ready, and we save it.
To add the right-click command, we need to restart Nautilus. One way is to reboot the whole system.
At the next boot, when right-clicking one or more audio files, we will find the "Nautilus-Actions actions" submenu on the context menu, and our personal "Enqueue in Rhythmbox" command inside.
This will enqueue the selected files in Rhythmbox.
Nautilus Actions uses this submenu so we can create as many right-click commands as we want, without cluttering the context menu.
If however we don't like the submenu, we can select Edit -> Preferences on Nautilus-actions.
There, we uncheck the "Create a root 'Nautilus-Actions' menu".
Now, each right-click command we create will show near the bottom of the context menu.
That's it. We can now create any possible right-click command in Ubuntu.
How to add right-click commands in Linux Mint
Nautilus-Actions can be installed on Linux Mint, but since Mint doesn't use Nautilus by default, it is entirely useless.
However, Linux Mint's file manager Nemo doesn't require a third-party application to create right-click commands on the context menu.
We just need to open /home.
Then we press Ctrl+H to show the hidden files and folders and select .local.
We navigate to .local->share->nemo->actions. There, we right-click and create an empty document.
We can name the document however we like, but it must have the extension .nemo_action.
Since Linux Mint doesn't have Rhythmbox, we will create a right-click command with Banshee, the default audio player.
We open the action file and type:
Name=Enqueue in Banshee
Comment=Enqueue in Banshee
Exec=banshee --play-enqueued %F
Selection = any
We don't need to restart the system. Right after we save the file, we can right-click one or more mp3 files. We will find the new command near the top of the context menu.
Clicking on it will open Banshee and enqueue the selected files.
If you need help with the syntax for Nemo Actions, you can consult this extensive file.
That's it. We can now create any possible right-click command in Linux Mint.
Did you create a right-click command in Ubuntu / Linux Mint?
If you created a command of your own, feel free to share it with us in the comment section.