I'm running gnome 3.10.1 on Arch with Zsh. I'm facing that problem that when I create a new tab or window from a terminal window, it resets the current dir to my home dir.

I've already tried this: gnome-terminal: keep track of directory in new tab, but it didn't work.

I tought that maybe it could be some configuration on my .zshrc file, so, I cleaned it up and put just the following line:

. /etc/profile.d/vte.sh

However, it didn't work as expected.

Yes, this file exists and here is its contents:

# Copyright © 2006 Shaun McCance <[email protected]>
# Copyright © 2013 Peter De Wachter <[email protected]>
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

# Not bash or zsh?
[ -n "$BASH_VERSION" -o -n "$ZSH_VERSION" ] || return 0

# Not an interactive shell?
[[ $- == *i* ]] || return 0

# Not running under vte?
[ "${VTE_VERSION:-0}" -ge 3405 ] || return 0

__vte_urlencode() (
  # This is important to make sure string manipulation is handled
  # byte-by-byte.
  while [ -n "$str" ]; do
    printf "%s" "$safe"
    if [ -n "$str" ]; then
      printf "%%%02X" "'$str"

# Print a warning so that anyone who's added this manually to his PS1 can adapt.
# The function will be removed in a later version.
__vte_ps1() {
  echo -n "(__vte_ps1 is obsolete)"

__vte_osc7 () {
  printf "\033]7;file://%s%s\a" "${HOSTNAME:-}" "$(__vte_urlencode "${PWD}")"

__vte_prompt_command() {
  printf "\033]0;%s@%s:%s\007%s" "${USER}" "${HOSTNAME%%.*}" "${PWD/#$HOME/~}" "$(__vte_osc7)"

case "$TERM" in
    [ -n "$BASH_VERSION" ] && PROMPT_COMMAND="__vte_prompt_command" 
    [ -n "$ZSH_VERSION"  ] && chpwd_functions+=(__vte_osc7)


This is really bugging me...

Is there any solution?

  • 2
    It is related to gnome-terminal, not to zsh. It seems to be a reported bug, although the bug behind the link is ubuntu-gnome's bug.
    – user37607
    Oct 27, 2013 at 19:14
  • 1
    have you tried terminator?
    – RSFalcon7
    Oct 30, 2013 at 11:57
  • Yeah, terminator works fine, but, for example, nautilus-open-terminal extension always open gnome-terminal, I've not been able to change it... Nov 15, 2013 at 22:11
  • 1
    Just wanted to point out that I had to restart gnome-terminal after sourcing vte.sh in my rc-file. Didn't work just by saving it and opening a new tab/window.. (using bash/arch/gnome3.10) Mar 29, 2014 at 6:49

2 Answers 2


I don't know if you're still running into this issue, but I found my problem was I was running /bin/zsh as a custom command in my terminal profile. Disabling that fixed the issue for me - and still kept zsh as my primary shell.

Terminal Profile

  • Exactly solved the problem for me using Fedora, thanks a lot!
    – Sven Hager
    Apr 23, 2016 at 14:46
  • 1
    changing that would mean using the default bash instead of zsh. so how does that fix the issue?
    – Alfie
    May 14, 2016 at 23:10
  • @Alfie The user is not using their default shell (probably bash). That means that the command that is executed to set the prompt (set up at login in /etc/profile.d/vte.sh) is not the right one and the terminal is not aware of the shell's current directory.
    – xhienne
    Aug 13, 2017 at 13:06
  • The screenshot is not up to date anymore. The second option does not exist anymore; ticking the first one did the trick. It's the default, but you have to set ZSH as your default shell with chsh, I presume.
    – slhck
    Dec 31, 2018 at 9:24

It seems like you have to enable the "Run command as a login shell" option in order to make it work like it should.

The print bellow is in Portuguese, but this is the configuration I've got it to work.


  • this would work, because you are not using zsh
    – Alfie
    May 14, 2016 at 23:11

You must log in to answer this question.

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