[HowTo] add custom scripts to Nautilus right click menu and assign keyboard shortcuts

Difficulty: ★☆☆☆☆

Copied from old forum and updated.

Similar to Thunar’s custom actions feature, Nautilus has a custom scripts feature. If you create bash scripts in the ~/.local/share/nautilus/scripts folder (you need to create this folder), they appear in the right-click menu like this:

For more details go here

Here are my basic scripts:

  • compare-files

    meld ./"$1" ./"$2"
  • convert-srt-to-utf8

    mv ./"$1" ./"$1.bak"
    iconv -f ISO-8859-9 ./"$1.bak" -t UTF-8 -o ./"$1"
    trash ./"$1.bak"
  • copy-path

    echo -n $(pwd)/"$1" | xclip -selection clipboard
  • create-backup

    cp -r ./"$1" ./"$1".bak
  • create-link-hard

    ln ./"$1" ./"$1".hardlink
  • create-link-soft

    ln -s ./"$1" ./"$1".softlink
  • edit-text

    kate ./"$1"
  • rm-rf (This one is dangerous!)

    rm -rf ./"$1"
  • search-in-folder

    catfish ./"$1"
  • show-disk-usage

    qdirstat ./"$1"
  • show-media-info

    mediainfo-gui ./"$1"
  • tar

    tar -cf ./"$1.tar" ./"$1"
  • upload-image

    imgurbash2 ./"$1"

You can also create keyboard shortcuts for your custom scripts. For example in order to open terminal in the current folder with the keyboard shortcut F4, create the below 2 files:

  • ~/.local/share/nautilus/scripts/terminal

  • ~/.config/nautilus/scripts-accels

    F4 terminal

    You can add multiple keyboard shortcuts to ~/.config/nautilus/scripts-accels

    F4 terminal
    F3 rm-rf

In order changes to take effect, quit nautilus with nautilus -q and open it again.

What are your custom scripts?