Nautilus is the default file browser in Ubuntu.
To assign a shortcut (F12) to the command “Open in Terminal” you can execute the following commands.
Tested on Ubuntu 22.02. Should also work on 18.04 and 20.04.
To change the shortcut edit ~/.config/nautilus/scripts-accels
nautilus -q
mkdir -p ~/.local/share/nautilus/scripts
mkdir -p ~/.config/nautilus/
echo '#!/bin/sh' > ~/.local/share/nautilus/scripts/Terminal
echo 'gnome-terminal' >> ~/.local/share/nautilus/scripts/Terminal
chmod u+rx .local/share/nautilus/scripts/Terminal
mkdir -p ~/.config/nautilus/scripts
sed -i 's/F12 Terminal//g' ~/.config/nautilus/scripts-accels
echo 'F12 Terminal' >> ~/.config/nautilus/scripts-accels
echo '; Commented lines must have a space after the semicolon' >> ~/.config/nautilus/scripts-accels
echo '; Examples of other key combinations:' >> ~/.config/nautilus/scripts-accels
echo '; <Control>F12 Terminal' >> ~/.config/nautilus/scripts-accels
echo '; <Alt>F12 Terminal' >> ~/.config/nautilus/scripts-accels
echo '; <Shift>F12 Terminal' >> ~/.config/nautilus/scripts-accels
sed -i '/^$/d' ~/.config/nautilus/scripts-accels
#ubuntu #nautilus #terminal #linux #opensource