2

I can start a new terminal tab with gnome-terminal --tab zsh. But now I want to also specify the directory of the new shell.

I couldn't find any options that wouldn't require me to put a cd in the .zshrc. This is not an option to me, since I want to specify the directory dynamically from the calling command. zsh -c doesn't seem to work and piping the command into zsh does not result in an interactive shell (and even if, I doubt I could pass this to the gnome-terminal command).

2
  • Try gnome-terminal --working-directory=directoryName --tab zsh
    – n8te
    Commented Feb 9, 2019 at 11:50
  • This does not work for me. Edit: Okay it does now, I had to expand the ~ manually for some reason
    – piegames
    Commented Feb 9, 2019 at 11:52

1 Answer 1

1

You'll want to add the --working-directory option.

From man gnome-terminal:

--working-directory=DIRNAME
Set the terminal's working directory to DIRNAME

So your command would be:

gnome-terminal --working-directory=DIRNAME --tab zsh
1
  • This is weird, I don't have the man page
    – piegames
    Commented Feb 9, 2019 at 16:10

You must log in to answer this question.

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