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
#!/bin/bash meld ./"$@" &
- Note: Install meld to use this script
-
convert-srt-to-utf8
#!/bin/bash for f in "$@" do mv ./"$f" ./"$f.bak" iconv -f $(uchardet ./"$f.bak") ./"$f.bak" -t UTF-8 -o ./"$f" trash ./"$f.bak" done notify-send "File(s) converted to UTF-8"
-
copy-path
#!/bin/bash mypath=$(pwd)/"$1" echo -n $mypath | xclip -selection clipboard notify-send "Path copied to clipboard:" "$mypath"
-
create-backup
#!/bin/bash for f in "$@" do cp -r ./"$f" ./"$f".bak done notify-send "Backup(s) created"
- Note: Install libnotify to use this script
-
create-link-hard
#!/bin/bash for f in "$@" do ln ./"$f" ./"$f".hardlink done
-
create-link-soft
#!/bin/bash for f in "$@" do ln -s ./"$f" ./"$f".softlink done
-
edit-image
#!/bin/bash for f in "$@" do ksnip -e $(pwd)/"$f" & done
- Note: Install ksnip to use this script
-
edit-text
#!/bin/bash gedit ./"$@" &
- Note: Install gedit to use this script
-
find-subtitles
#!/bin/bash qnapi "$@" &
- Note: Install qnapi to use this script
-
rm-rf (This one is dangerous!)
#!/bin/bash rm -rf ./"$@" foo=$@ notify-send "Files removed:" "$foo"
- Note: Install libnotify to use this script
-
search-in-folder
#!/bin/bash catfish ./"$1" &
- Note: Install catfish to use this script
-
show-disk-usage
#!/bin/bash qdirstat ./"$1" &
- Note: Install qdirstat to use this script
-
show-media-info
#!/bin/bash for f in "$@" do mediainfo-gui ./"$f" & done
- Note: Install mediainfo-gui to use this script
-
upload-image
#!/bin/bash for f in "$@" do imgurbash2 ./"$f" done notify-send "Image link(s) copied to clipboard"
- Note: Install imgurbash2 and libnotify to use this script
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
#!/bin/bash gnome-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?