How can I create a keyboard shortcut so that when I press F12 in nautilus (or desktop), I get a terminal in the current directory?
How can I create a keyboard shortcut so that when I press F12 in nautilus (or desktop), I get a terminal in the current directory?
Edit: not anymore applicable for Ubuntu 16.10 and newer
Finally figured it out.. first
sudo apt-get install dconf-tools nautilus-open-terminal
, then rundconf-editor
and set theorg/gnome/desktop/interface/can-change-accels
boolean on. Then open nautilus using this command (to disable Unity global menu Temporarily):Now you can mouseover the action in the file menu, and change the accel by typing your key while the action is highlighted, finally restart your nautilus. If you don't see Open in terminal in the File menu and you've just installed
nautilus-open-terminal
, you might need to first runnautilus -q
.Ubuntu 14.04 and up
If you can't find the
can-change-accels
key in your dconf configuration you can try the following solution:Stop nautilus by executing
nautilus -q
Open
~/.config/nautilus/accels
in a text editor of your choice, e.g. gedit:Try to see if you can find the following line:
If the line exists, add your keyboard shortcut in the second double-quoted segment and uncomment the line by removing
;
:This would set the shortcut to F12. For a list of all possible key codes please consult this answer.
If the line doesn't exist just copy and paste the one found in this answer at the end of the file.
Save the file and restart Nautilus by clicking on the Nautilus icon in your launcher/dash.
Ubuntu 15.10 and 16.04
Here, the relevant command in
~/.config/nautilus/accels
isTerminalNautilus:OpenFolderLocal
. (NautilusOpenTerminal::open_terminal
is still present in the file, but doesn't seem to have any effect.) So follow the instructions above, except change the lineto
to make F12 your keyboard shortcut. Notice that
;
is again removed.Finally, log out for changes to take effect.
Since version 3.15.4 Nautilus doesn't load the accel file anymore (Source).
Fortunatelly there's a better aproach in order to get what you want. Long explanation/useful resources can be found here and also here. In short:
Create a script called
Terminal
(yes, without a extension) inside the folder~/.local/share/nautilus/scripts
with the following content:Make it executable, then close any Nautilus instance:
Create (or edit) the
~/.config/nautilus/scripts-accels
file adding these lines:Test it! Open Nautilus, right click, and choose Scripts > Terminal. Or, use the keyboard shortcut that you've just configured :)
Note: Tested on Ubuntu 18.04.
Update Ubuntu 20.10: Unfortunately, this does not anymore work in Nautilus 3.38 (Ubuntu 20.10).
Update Ubuntu 21.10: Fortunatelly, the
scripts-accels
file works again in Files 40 (Ubuntu 21.10)Using the dconf-editor approach doesn't seem to work in Trusty Gnome. But the following does:
In your home directory press Ctrl+h, open the .config folder, the nautilus folder, and the accels file;
ie, open
~/.config/nautilus/accels
and change the line:to
Note that the comment delimiter has been removed.
Save the file, log out and back in.
Not exactly the answer for this question
If all you want is access the terminal in the current directory, you can do that with
Ctrl + F10 then e
Ctrl + F10: Same as right click at the current directory
e: Selects "Open in Terminal"
It can change if your OS is in another language.
For example, in portuguese from brasil would be:
Ctrl + F10 then t
Just look at the underlined letter to know the key.
If you are using notebook you may have to use the super key too.
Ctrl + Super + F10 then e
You mentioned opening from Desktop, the closest i could think is opening the terminal on home directory.
Ctrl + Alt + t
You could also use a nautilus script instead of a dedicated extension:
Instructions on installing the script and assigning a keyboard shortcut.
To expand on
John F. Healy
's post:This should work on Ubuntu 14.10 Utopic Unicorn. The last line edits the
~/.config/nautilus/accels
file. To make sure the edit was successful, try the following command:After installing
nautilus-open-terminal
, ensure that you have killed all nautilus processes (there's always one non visible nautilus process running, so usepgrep nautilus
to find them and use then use thekill
command).Then if you launch nautilus, you should see the Open in Terminal if you right-click in the list of files, like I did in the screenshot below (where I was running 14.04):
Besides configuring by hand, there is also a GUI application to manage these shortcuts: https://github.com/echo-devim/nautilusaccelsmanager (tested)
It's pretty useful since the configuration fails because of tiny stuff like capitalization. With this useful tool, just press the desired hotkeys and configuration with the right style is produced.
For a detailed insight of how it works, see https://askubuntu.com/a/696901/1147792.
I would do a right click in your file browser or desktop with
Then find the "Open in Terminal" option.