17

How can I set a shortcut for open terminal in current directory for nautilus?

I'm using Nautilus 3.16.2 and I already tried this answer but look like it's broken in newer version.

1

3 Answers 3

25

I added a new feature to Nautilus with the precious help of the maintainers.

This new feature allow you to map custom keyboard shortcuts to launch the scripts in the scripts folder ( ~/.local/share/nautilus/scripts ).

So, when you add an executable in that folder it will appear in the right-click context menu, but now if you create a special configuration file ( ~/.config/nautilus/scripts-accels ) you can assign a shortcut to it.

For example make a script called Terminal with the following content:

#! /bin/sh
gnome-terminal

Now create (or edit) the ~/.config/nautilus/scripts-accels file adding the following lines:

F4 Terminal

; Commented lines must have a space after the semicolon
; Examples of other key combinations:
; <Control>F12 Terminal
; <Alt>F12 Terminal
; <Shift>F12 Terminal

Restart Nautilus (nautilus -q) and when you'll press F4 key you'll open a new terminal window in the current directory (feel free to create a new key combination following the commented lines examples).

Note: if you select one or more files, their names will be passed as parameters to the executable. Your script can also have access to many information through environment variables.

Link of the commit: https://git.gnome.org/browse/nautilus/commit/?id=9fe1335

There is also a gui to manage these shortcuts: https://github.com/echo-devim/nautilusaccelsmanager

9
  • 1
    This method works with 3.28.1.
    – orschiro
    Jul 18, 2018 at 11:14
  • 2
    Make sure you provide executable permissions to the Terminal script. chmod +x ~/.local/share/nautilus/scripts/Terminal. See here: askubuntu.com/a/1062263/775359 May 30, 2019 at 9:01
  • 1
    Successfully tested on Ubuntu 20.04 LTS! 🎉
    – Salim B
    May 8, 2020 at 16:14
  • 1
    This isn't working for me on Ubuntu 20.04 LTS. I have a script named "Terminal", executable, that works fine when right-clicking a file. I put "<Alt>T Terminal" in the scripts-accels file, and the shortcut even says "Alt+T" on the context menu for the script. However, the shortcut keys don't work. Do you HAVE to use F-keys? How do you assign a shortcut using normal keys?
    – Septem151
    Jul 9, 2021 at 3:29
  • 1
    I confirm that this solution is working on Ubuntu 22.04 LTS. Configured opening the terminal by Shift + F9. F9 like in Krusader is not working since this key is used to show/hide sidebar of Nautilus. As @NagabhushanSN mentioned chmod +x ~/.local/share/nautilus/scripts/Terminal needs to be added to the answer. Jun 3, 2022 at 11:05
5

According to News file inside nautilus git repository, since version 3.15.4 accells not loaded any more

Major changes in 3.15.4:
* Stop loading custom accel maps file

Fortunately for nautilus >= 3.20 "RobotMan" answer solved the problem.

1
  • Its 2022. I switched to the Thunar and god it's awesome. Packed with nice GUI to easily map any script to any key binding with tons of other cool features and options. Still Nautilus stick to it's shitty search UX, hard way to set shortcut and very bad keyboard focus handling.
    – pazel1374
    Mar 29, 2022 at 4:55
2

2020
One option is to use:
Ctrl + F10 then e

Ctrl + F10: Same as right click at the current folder
e: Selects "Open in Terminal"

This is my favorite because you don't have to change any settings


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 must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .