0

I have installed the following on Ubuntu 20.10

  1. zsh
  2. Oh my zsh
  3. terminator

When I open a new tab or split window in the terminator, I find that the current working directory is copied from the previous session. I want to instead be in the home directory whenever I open a new terminal.

For example

  • I have an open terminal in directory /home/user/folder1
  • I open a new terminal
  • New terminal is in /home/user/folder1

How can I prevent this from happening?

Currently I have added this line in .zshrc

cd $HOME

But I do not really like this solution as it prevents me from using open in terminal from context menu from nautilus.

Please help me figure out how I can always open a new terminal to go to home dir.

5
  • Any question should always include the version of Ubuntu you are using. What version is it?
    – David
    Jan 25, 2021 at 6:36
  • Added this to the question. It's 20.10 Jan 25, 2021 at 7:19
  • its messy, but I use konsole and it can be started with a profile... so this solution would kill your session (perhaps saving it as below) and start a new profile with one more line added to the konsole profile text file for a new home folder. the disadvantage of course is to kill off your processes running in the current session. konsole --tabs-from-file <filename>. add a gnome shortcut key to kill session and start new with new home tab. 'terminator' ?? lol = terminal
    – pierrely
    Jan 26, 2021 at 5:14
  • better still ,konsole in preferences has the ability to set it this way. settings, configure konsole, profiles, select yours, initial directory (default is home) and unclick 'start in same directory as current session (meaning tab I think). worked for me.
    – pierrely
    Jan 26, 2021 at 5:17
  • @pierrely thanks for the suggestion. I changed my profile as per your clue and fixed my issue. Answered my own question below Jan 26, 2021 at 16:08

1 Answer 1

1

I did the following and solved my problem within terminator

  1. Go to preferences -> profiles [default] -> Command
  2. Check Run a custom command instead of my shell
  3. Set the custom command as cd /home/mydir; exec /usr/bin/zsh

Now a new terminal opens in the home dir instead of the current working directory of the previous terminal

You must log in to answer this question.

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