How do I add a refresh option in the right click menu in Ubuntu 16.04?

I'd like to have an option on the right-click menu to refresh Nautilus.

How can I achieve that?


Refresh button for Nautilus on right-click menu

enter image description here

  • You will need a to download xdotool and nautilus-actions:

    sudo apt install xdotool nautilus-actions
    
  • Open nautilus-actions and do the following:

    1. Create a new action and change it's name to Refresh
    2. On the Action tab, enable Display item in location context menu
    3. On the Command tab set the Path to /usr/bin/xdotool, Parameters to key F5.
    4. Save your changes.
    5. Now go to Nautilus Action's Edit > Preferences and get both options at Runtime preferences > Nautilus menu layout deselected.
    6. Open a terminal and run nautilus -q
    7. Done! Open Nautilus and try it out :)

Also works on 18.04, but nautilus-actions was renamed to filemanager-actions. Still waiting for filemanager-actions to be added to the repos, but it's available on a development PPA as a workaround:

https://launchpad.net/~tomtomtom/+archive/ubuntu/filemanager-actions

Ref: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1768597

filemanager-actions interface is slightly different. Updated instructions (with thanks to above).

sudo add-apt-repository ppa:tomtomtom/filemanager-actions
sudo apt update
sudo apt install filemanager-actions xdotool

# Run with (as user):
fma-config-tool 

Once installed, open filemanager-actions with fma-config-tool and do the following:

To Create the new "Refresh" option:

  • 'Define a new action' and change its name to Refresh
  • On the Action tab, enable 'Display item in location context menu'
  • On the Command tab set the Path to /usr/bin/xdotool, Parameters, type in 'key F5' without quotes.
  • Save your changes with File/Save.

To set the context menu to show directly, and not in a sub-menu:

  • In top menu, under 'Filemanager-Actions Configuration Tool' select 'Preferences'
  • In the Runtime preferences tab, disable the following:
    • Create a root 'Filemanager-Actions' menu
    • Add an 'About Filemanager-Actions' item...

Kill all existing nautilus windows with: Open a terminal and run nautilus -q

Start Nautilus.