gnome-terminal. New tab opening

4

I am launching the gnome-terminal and I am working in a specific path, for example: /home/user/programs/c.

Now I am opening another tab. When I am opening the new tab it is also in the same path, i.e. the new tab's working directory will be /home/user/programs/c.

But what I want is when I am opening a new tab its working directory should be /home/user.

How can I achieve this? Any help much appreciated. Thanks in Advance!

thillai-selvan

Posted 2010-03-27T05:15:47.750

Reputation:

Same problem, I'd like the old behavior. No options in dconf. - From user1585507

– Canadian Luke – 2013-05-03T20:56:16.893

Answers

2

Same as here

The solution is to check "Run command as a login shell" in the preferences. It worked for me.

Check the FAQ

Rififi

Posted 2010-03-27T05:15:47.750

Reputation: 131

No, that's what you would do if you wanted each tab to continue in the same directory but it wasn't working. Op has the opposite problem, it's currently doing that and he wants it to start in the home directory each time. – Segfault – 2018-09-06T14:13:56.850

1

There doesn't seem to be any way to override this behaviour from withing gnome-terminal itself. The easiest workaround that I have found is to add an explicit cd to your ~/.bashrc file.

echo 'cd $HOME' >> ~/.bashrc

Then when you open a new tab, it will change the current directory back to your home directory.

richq

Posted 2010-03-27T05:15:47.750

Reputation: 1 130

Nice fix. I hope they will integrate it in the next version of Gnome Terminal. Konsole is my primary terminal emulator, though. :-) – Alan Haggai Alavi – 2010-06-01T15:04:53.313

Alan, actually it's a feature that GNOME terminal starts new tabs in the current directory. – Paolo Bonzini – 2013-03-21T12:49:33.223

@PaoloBonzini, indeed I agree, it's a feature. Unfortunately the behaviour seems to have changed with Gnome 3.8. How do I get back the old behaviour? – Magnus – 2013-04-29T10:57:15.823

0

This is a feature of gnome-terminal that everyone seems to like but me and thillai-selvan. There is a lot of documentation on how to fix it when it's not working right (that is, when a new tab is opening in the same directory as the previous tab). However, there is little information on how to disable the feature. It can't be disabled in the gnome-terminal UI or any config files as far as I can tell. So you need to break it or circumvent it.

For my use case, echo 'cd $HOME' >> ~/.bashrc is not a good solution, because in some applications I would like them to be able to open in a different directory, mainly the embedded terminal in vscode, and that line in bashrc will prevent it.

The feature is implemented by providing a PROMPT_COMMAND that records the current directory every time a prompt is generated. Current versions of gnome implement this by installing a vte script into /etc/profile.d. You should be able to remove that file (back it up so you can restore it later if you want) and disable this feature.

Segfault

Posted 2010-03-27T05:15:47.750

Reputation: 413