1

I'd like to know the shortcut that lets you open a terminal window in a specific directory just like when you press the left button on it and you click on 'Open in terminal' in the pop-up menu.

Thanks in advance !!

DBG
  • 11

2 Answers2

3

The shortest way in a default installation is Ctrl+F10 E. There is no single shortcut key to directly open a terminal.

Caveat In Ubuntu 22.04 (Files 42.2) this is broken. Ctrl+F10 E now opens the folder menu of the bar (⁞) instead of the right-click context menu. That behavior also breaks the use of the Python extension described below to a large extent. Still, assigning a nautilus specific shortcut using the extension works.

A good way to implement a direct shortcut key is to replace the default extension by a nautilus python extension, nautilus-open-any-terminal. Next to allowing for a single shortcut key, it allows you to substitute a terminal of your choice, if you wish.

  1. Quit nautilus fully

    nautilus -q

  2. Make sure python3-nautilus is installed: sudo apt install python3-nautilus

  3. Install the extension, either using pip as indicated on the website, or by grabbing the source code and placing it in a text file ~/.local/share/nautilus-python/extensions/open_any_terminal_extension.py.

  4. Enable the dconf settings

    glib-compile-schemas ~/.local/share/glib-2.0/schemas/

  5. Define the settings:

gsettings set com.github.stunkymonkey.nautilus-open-any-terminal terminal gnome-terminal

Supply gnome-terminal or any other of the terminals listed in the source code.

gsettings set com.github.stunkymonkey.nautilus-open-any-terminal keybindings '<Ctrl><Alt>t'

to set the Nautilus keybinding for opening the terminal.

gsettings set com.github.stunkymonkey.nautilus-open-any-terminal new-tab true

if you want to open the current directory in a new tab in a running instance. Otherwise, it will be a new window.

Bonus tips:

  • Remove the now superfluous default extension: sudo apt remove nautilus-extension-gnome-terminal.

  • Enable hotkeys in the right-click menu by editing the source code of the extension: where the menu label is defined, add an underscore before the letter you want to activate as a hotkey for the function, as in

    label=_(u"Op_en {} Here").format(terminal.title()),

With this example, also Ctrl+F10 E will work to open a terminal here.

vanadium
  • 88,010
2

I have recently moved to Ubuntu 22.04.2 LTS and had the exact issue of not being able to open the terminal on the current directory. For example, in windows I could use alt+d and then write cmd, and the terminal would open in the current directory.

This is the closest I could get to open terminal in the current working directory using just the keyboard (it has a bit more keystroke but might be useful also)

When we are in a folder and want to open the terminal at the same place, then the following keystroke brings the terminal up in the current directory

shift+f10 then two up arrow keystroke and enter

I have to say I came across this by accident while pressing some keys on my keyboard.

I hope it helps :)

UPDATE I: I just noticed one limitation of this approach while using the above-mentioned approach. If I am already selecting one file/folder, then shift+f10 does not open the floating window that has Open in Terminal option, but it opens another floating window that is specifically related to the file/folder I have selected.

UPDATE II: Found a more convinent way shift+f10 + e. This works like a charm (given the limitation mentioned in UPDATE I sadly)

Zubaer
  • 21
  • 3
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center. – Community Apr 05 '23 at 13:40