1

Whenever I've got a running terminal instance and for example go into my file manager and right click "open in terminal" a new terminal instance starts.

How can I change it so that a new tab opens in the already existing terminal instance?

I'm running Ubuntu 18.04.4 LTS with gnome desktop.

  • 1
    To start with, which version of Linux have you installed  (Ubuntu server, Ubuntu desktop, Kubuntu, Lubuntu, Xubuntu, Ubuntu MATE, et al.) , and which release number? Different releases have different tools for us to recommend. Please click [edit] and add that vital information to your question so all the facts we need are in the question. Please don't use Add Comment, since that's our channel to you. All facts about your system should go in the Question with [edit] – K7AAY Apr 17 '20 at 16:30
  • With default gnome-terminal in standard Ubuntu, it probably still is not possible. A hack was suggested here: https://askubuntu.com/questions/55656/open-nautilus-as-a-new-tab-in-an-existing-window. However indeed, specify which desktop environment you use. – vanadium Apr 17 '20 at 16:47
  • If there are two terminal open, what do you want it to do? where should the new tab be opened? – Severus Tux Apr 19 '20 at 14:07

1 Answers1

0

This can be easily achieved on thunar and xfce4-terminal File manager.

(It can also be achieved on Nautilus and xfce4-terminal, but you will have to install filemanager-actions. I have explained both)

On Thunar, click on edit->Configure custom actions...

enter image description here

Create new action by clicking on + and fill as given below.

Give the command as:

xfce4-terminal --tab --working-directory=%f 

Set an icon of your choice.

In Appearance Conditions tab, check Directories.

and Save. enter image description here

You should get it on your right click menu:

enter image description here

NOTE: Doing similar steps on Nautilus with filemanager-actions for gnome-terminal creates a new window instead of new tab. But it works fine with xfce4-terminal.

For nautilus:

Install filemanager-actions

sudo apt install filemanager-actions

Open filemanager-actions

Create a new action.

enter image description here

Choose an icon, check all those options.

enter image description here

set path as xfce4-terminal

and parameters --tab --working-directory="%d"

and save.

It should show up on your right click menu like this:

enter image description here


If you want this behavior to be the default, you can achieve it my setting alias for gnome-terminal as gnome-terminal --tab in your /etc/bash.bashrc or ~/.bashrc.

Severus Tux
  • 9,866
  • Thank you Severus. But I was looking for a more general solution. So if I want to open a new terminal wherever and one already exists the new one will be a new tab by default. Do you have an idea how that might work? – GrumpyLTS Apr 20 '20 at 08:14
  • @Grumpy How do you open terminals? You could just alias gnome-terminal to gnome-terminal --tab in your /etc/bashrc (for all users) or set keyboard shortcut ctrl +alt +T to gnome-terminal --tab. – Severus Tux Apr 20 '20 at 14:44