You can use the FileManager-Actions GUI program to add custom entries (“actions”) to the context menu that pops up when you right click in a file manager.

Download FileManager-Actions

Download FileManager-Actions by running the following commands:

sudo add-apt-repository ppa:daniel-marynicz/filemanager-actions

sudo apt update

sudo apt install filemanager-actions-nautilus-extension

Add An Entry (aka Action)

Launch FileManager-Actions (search for file manager actions after hitting the super key).

Here is roughly what you’ll see: FileManager-Actions

Click on File->New action to add a new entry to the right click menu. You’ll see it pop up in the item list on the left hand side of the GUI. The item list is basically a list of entries you have defined for the right click menu.

Select your newly created action. All the tabs on the right hand side of the GUI allow you to edit when this entry will show, and what will happen when the user clicks it. You can mouse over tabs to learn more about what kind of things that tab lets you specify for your action. Similarly, you can mouse over particular options in a tab to learn more about them. The GUI is pretty friendly to use, just mouse over stuff you don’t understand!

We will take a look at the most important options.

Options

Action tab: Action tab

Command tab: Action tab

You can use the Basenames tab to specify how the base names of the files/folders that are selected effect whether the action is displayed or not when the user right clicks.

You can use the Mimetypes tab to specify how the mime types (basically file types (i.e. text, audio, video, image, css, javascript, etc)) of the selected files/folders effect whether the action is displayed or not.

You can use the Folders tab to specify how the location of the parent folder of the selected files/folders effects whether the action is displayed or not. For example, you can have certain actions only show up when you right click in a particular folder.

The Environment tab allows you to specify some more fancier conditions that must be true in order for your action to be displayed. For example, you can require a certain number of files/folders be selected. Additionally, you can require an arbitrary command to return the string “true” (to stdout) in order for the action to be displayed.

Saving/Viewing

After you are happy with your action, click on File->Save. Then exit nautilus (the ubuntu file manager) by running nautilus -q in a terminal. You must do this in order for your actions to appear in the context menu.

You must quit nautilus (by running nautilus -q) in order to update the right click entries after you’ve made some changes.