Open a new tab in the same directory











up vote
41
down vote

favorite
14












Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder.



How would you do that?



I use Mac OS and Zsh.










share|improve this question




























    up vote
    41
    down vote

    favorite
    14












    Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder.



    How would you do that?



    I use Mac OS and Zsh.










    share|improve this question


























      up vote
      41
      down vote

      favorite
      14









      up vote
      41
      down vote

      favorite
      14






      14





      Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder.



      How would you do that?



      I use Mac OS and Zsh.










      share|improve this question















      Say you are in /very/cool/and/deeply/nested/folder . And you want to open a new terminal tab in the same folder.



      How would you do that?



      I use Mac OS and Zsh.







      macos terminal zsh






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Aug 19 '14 at 16:00









      Braiam

      3,99631851




      3,99631851










      asked Jan 13 '11 at 17:36









      Nerian

      81221020




      81221020






















          10 Answers
          10






          active

          oldest

          votes

















          up vote
          59
          down vote



          accepted










          Use Oh-My-Zsh and add the 'osx' plugin in your ~/.zshrc like:



          plugins=(osx)


          If you use OSX's Terminal App, you also need to add the terminalapp plugin too: credit



          plugins=(osx terminalapp)


          If you use iTerm you need to set a configuration option (Note that you may not need the zsh plugins for this to work): credit




          Preferences > Profiles > Default > General > Working Directory > Reuse previous session's directory option




          iTerm2 Preferences panel update to reuse previous session directory.



          That's all you need to do!






          share|improve this answer



















          • 1




            does this also work in iTerm ?
            – ahmy
            May 30 '12 at 7:59






          • 1




            @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
            – philfreo
            Jun 25 '12 at 17:52






          • 2




            This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
            – YWCA Hello
            Aug 20 '13 at 22:08










          • @YWCAHello have you found solution to this problem?
            – Michał Miszczyszyn
            Oct 7 '14 at 8:30










          • @Miszy I moved back to vanilla Bash :/
            – YWCA Hello
            Oct 7 '14 at 15:45


















          up vote
          21
          down vote













          Another option now available in Mac OS X Lion is using the built-in feature. It uses 'escape sequences' to find out the current directory. For me it works if I use these commands in my .zshrc:



          precmd () {print -Pn "e]2; %~/ a"}
          preexec () {print -Pn "e]2; %~/ a"}


          it is also possible to use PS1 (for Bash, from this wiki):



          export PS1="[e]2;u@H wae[32;1m]>[e[0m] "


          where e]2; is the escape sequence to print things in the titlebar. It seems that Terminal.app is getting its information from there.



          More information:




          • http://networking.ringofsaturn.com/Unix/Bash-prompts.php

          • http://www.funtoo.org/wiki/Prompt_Magic

          • http://tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html






          share|improve this answer





















          • also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
            – Tim
            Aug 8 '11 at 7:18










          • As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
            – Chris Page
            Mar 10 '12 at 22:04








          • 2




            The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
            – Chris Page
            Mar 10 '12 at 22:29






          • 3




            Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
            – Nick
            Apr 18 '12 at 15:53






          • 1




            I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
            – mareoraft
            Dec 18 '15 at 23:41


















          up vote
          3
          down vote













          This is a very simple version which I used in bash and also works in zsh.
          It saves the current folder in a file, after every command (Doesn't hurt too much IMO)
          and opens a new terminal in the saved current folder.



          add the following to .zshrc



          # emulate bash PROMPT_COMMAND (only for zsh)
          precmd() { eval "$PROMPT_COMMAND" }
          # open new terminal in same dir
          PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
          [[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"





          share|improve this answer





















          • This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
            – mareoraft
            Dec 18 '15 at 23:46


















          up vote
          1
          down vote













          gdirs seems like a way to almost do it: new tab, then gdirs to select the deep directory and voila.
          My first idea was to make the directory stack shared among all tabs and do cd ~1 after the new tab, but I cannot find how to do that, as it seems each instance of zsh keeps its own. History sharing goes via a common file, so maybe that could be done here too...






          share|improve this answer




























            up vote
            0
            down vote













            This is how you do it in bash.



            This shell script will tell (quiet literally, using Applescript) Terminal.app to open a new tab then switch to the current directory:



            #!/bin/bash
            osascript -e 'tell application "Terminal"'
            -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
            -e "do script with command "cd `pwd`;clear" in selected tab of the front window"
            -e 'end tell' &> /dev/null


            … put the above shell script in a directory in your $PATH (i.e. /usr/local/bin) and make sure it’s executable:



            $ chmod +x /usr/local/bin/nt


            (source)






            share|improve this answer





















            • Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
              – Chris Page
              Mar 10 '12 at 22:22


















            up vote
            0
            down vote













            If you need to open this new tab right now, without changing your config files or installing new plugins, run this:



            pwd | pbcopy


            Then open a new Terminal tab manually (with ⌘T), and in the new tab:



            cd "`pbpaste`"


            Warning: this will overwrite the contents of the system clipboard.





            An alternative, longer method that does not overwrite the clipboard:



            pwd > $TMPDIR/wd


            Open your new tab.



            cd "$(cat $TMPDIR/wd)"
            rm -f $TMPDIR/wd





            share|improve this answer






























              up vote
              0
              down vote













              Per Pieter's comment above, once the plugins=(git osx) plugins are installed, you can just type tab and it will open a new tab in your current directory.






              share|improve this answer




























                up vote
                0
                down vote













                If you want the directory to change automatically when a new tab is opened use the dirpersist plugin.



                The osx plugin only does save the last directory but you have to run the command tab to open a new tab, which is not always possible (if, say, you're running something in your current tab).






                share|improve this answer




























                  up vote
                  0
                  down vote













                  Adding terminalapp to .zshrc didn't work for me so I looked for the plugin ~/.oh-my-zsh/plugins/terminalapp and it tells me:



                  # This file is intentionally empty.
                  #
                  # The terminalapp plugin is deprecated and may be removed in a future release.
                  # Its functionality has been folded in to the core lib/termsupport.zsh, which
                  # is loaded for all users. You can remove terminalapp from your $plugins list
                  # once all your systems are updated to the current version of Oh My Zsh.





                  share|improve this answer






























                    up vote
                    0
                    down vote













                    New tabs already open in the same folder (Cmd+T).
                    For new windows (Cmd+N) the solution from Pieter is right:




                    Preferences > Profiles > Default > General > Working Directory > Reuse
                    previous session's directory option







                    share|improve this answer








                    New contributor




                    Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.


















                      Your Answer








                      StackExchange.ready(function() {
                      var channelOptions = {
                      tags: "".split(" "),
                      id: "3"
                      };
                      initTagRenderer("".split(" "), "".split(" "), channelOptions);

                      StackExchange.using("externalEditor", function() {
                      // Have to fire editor after snippets, if snippets enabled
                      if (StackExchange.settings.snippets.snippetsEnabled) {
                      StackExchange.using("snippets", function() {
                      createEditor();
                      });
                      }
                      else {
                      createEditor();
                      }
                      });

                      function createEditor() {
                      StackExchange.prepareEditor({
                      heartbeatType: 'answer',
                      convertImagesToLinks: true,
                      noModals: true,
                      showLowRepImageUploadWarning: true,
                      reputationToPostImages: 10,
                      bindNavPrevention: true,
                      postfix: "",
                      imageUploader: {
                      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                      allowUrls: true
                      },
                      onDemand: true,
                      discardSelector: ".discard-answer"
                      ,immediatelyShowMarkdownHelp:true
                      });


                      }
                      });














                       

                      draft saved


                      draft discarded


















                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f232835%2fopen-a-new-tab-in-the-same-directory%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown

























                      10 Answers
                      10






                      active

                      oldest

                      votes








                      10 Answers
                      10






                      active

                      oldest

                      votes









                      active

                      oldest

                      votes






                      active

                      oldest

                      votes








                      up vote
                      59
                      down vote



                      accepted










                      Use Oh-My-Zsh and add the 'osx' plugin in your ~/.zshrc like:



                      plugins=(osx)


                      If you use OSX's Terminal App, you also need to add the terminalapp plugin too: credit



                      plugins=(osx terminalapp)


                      If you use iTerm you need to set a configuration option (Note that you may not need the zsh plugins for this to work): credit




                      Preferences > Profiles > Default > General > Working Directory > Reuse previous session's directory option




                      iTerm2 Preferences panel update to reuse previous session directory.



                      That's all you need to do!






                      share|improve this answer



















                      • 1




                        does this also work in iTerm ?
                        – ahmy
                        May 30 '12 at 7:59






                      • 1




                        @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
                        – philfreo
                        Jun 25 '12 at 17:52






                      • 2




                        This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
                        – YWCA Hello
                        Aug 20 '13 at 22:08










                      • @YWCAHello have you found solution to this problem?
                        – Michał Miszczyszyn
                        Oct 7 '14 at 8:30










                      • @Miszy I moved back to vanilla Bash :/
                        – YWCA Hello
                        Oct 7 '14 at 15:45















                      up vote
                      59
                      down vote



                      accepted










                      Use Oh-My-Zsh and add the 'osx' plugin in your ~/.zshrc like:



                      plugins=(osx)


                      If you use OSX's Terminal App, you also need to add the terminalapp plugin too: credit



                      plugins=(osx terminalapp)


                      If you use iTerm you need to set a configuration option (Note that you may not need the zsh plugins for this to work): credit




                      Preferences > Profiles > Default > General > Working Directory > Reuse previous session's directory option




                      iTerm2 Preferences panel update to reuse previous session directory.



                      That's all you need to do!






                      share|improve this answer



















                      • 1




                        does this also work in iTerm ?
                        – ahmy
                        May 30 '12 at 7:59






                      • 1




                        @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
                        – philfreo
                        Jun 25 '12 at 17:52






                      • 2




                        This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
                        – YWCA Hello
                        Aug 20 '13 at 22:08










                      • @YWCAHello have you found solution to this problem?
                        – Michał Miszczyszyn
                        Oct 7 '14 at 8:30










                      • @Miszy I moved back to vanilla Bash :/
                        – YWCA Hello
                        Oct 7 '14 at 15:45













                      up vote
                      59
                      down vote



                      accepted







                      up vote
                      59
                      down vote



                      accepted






                      Use Oh-My-Zsh and add the 'osx' plugin in your ~/.zshrc like:



                      plugins=(osx)


                      If you use OSX's Terminal App, you also need to add the terminalapp plugin too: credit



                      plugins=(osx terminalapp)


                      If you use iTerm you need to set a configuration option (Note that you may not need the zsh plugins for this to work): credit




                      Preferences > Profiles > Default > General > Working Directory > Reuse previous session's directory option




                      iTerm2 Preferences panel update to reuse previous session directory.



                      That's all you need to do!






                      share|improve this answer














                      Use Oh-My-Zsh and add the 'osx' plugin in your ~/.zshrc like:



                      plugins=(osx)


                      If you use OSX's Terminal App, you also need to add the terminalapp plugin too: credit



                      plugins=(osx terminalapp)


                      If you use iTerm you need to set a configuration option (Note that you may not need the zsh plugins for this to work): credit




                      Preferences > Profiles > Default > General > Working Directory > Reuse previous session's directory option




                      iTerm2 Preferences panel update to reuse previous session directory.



                      That's all you need to do!







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jun 17 '14 at 16:06









                      NReilingh

                      5,04422046




                      5,04422046










                      answered Mar 6 '12 at 20:17









                      Pieter

                      70662




                      70662








                      • 1




                        does this also work in iTerm ?
                        – ahmy
                        May 30 '12 at 7:59






                      • 1




                        @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
                        – philfreo
                        Jun 25 '12 at 17:52






                      • 2




                        This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
                        – YWCA Hello
                        Aug 20 '13 at 22:08










                      • @YWCAHello have you found solution to this problem?
                        – Michał Miszczyszyn
                        Oct 7 '14 at 8:30










                      • @Miszy I moved back to vanilla Bash :/
                        – YWCA Hello
                        Oct 7 '14 at 15:45














                      • 1




                        does this also work in iTerm ?
                        – ahmy
                        May 30 '12 at 7:59






                      • 1




                        @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
                        – philfreo
                        Jun 25 '12 at 17:52






                      • 2




                        This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
                        – YWCA Hello
                        Aug 20 '13 at 22:08










                      • @YWCAHello have you found solution to this problem?
                        – Michał Miszczyszyn
                        Oct 7 '14 at 8:30










                      • @Miszy I moved back to vanilla Bash :/
                        – YWCA Hello
                        Oct 7 '14 at 15:45








                      1




                      1




                      does this also work in iTerm ?
                      – ahmy
                      May 30 '12 at 7:59




                      does this also work in iTerm ?
                      – ahmy
                      May 30 '12 at 7:59




                      1




                      1




                      @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
                      – philfreo
                      Jun 25 '12 at 17:52




                      @ahmy looks like it should: github.com/robbyrussell/oh-my-zsh/blob/master/plugins/osx/…
                      – philfreo
                      Jun 25 '12 at 17:52




                      2




                      2




                      This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
                      – YWCA Hello
                      Aug 20 '13 at 22:08




                      This works for me unless I'm running a process in the console. If I have a process, say rails running, and I try to open a new window via command-n, I end up back at my home directory.
                      – YWCA Hello
                      Aug 20 '13 at 22:08












                      @YWCAHello have you found solution to this problem?
                      – Michał Miszczyszyn
                      Oct 7 '14 at 8:30




                      @YWCAHello have you found solution to this problem?
                      – Michał Miszczyszyn
                      Oct 7 '14 at 8:30












                      @Miszy I moved back to vanilla Bash :/
                      – YWCA Hello
                      Oct 7 '14 at 15:45




                      @Miszy I moved back to vanilla Bash :/
                      – YWCA Hello
                      Oct 7 '14 at 15:45












                      up vote
                      21
                      down vote













                      Another option now available in Mac OS X Lion is using the built-in feature. It uses 'escape sequences' to find out the current directory. For me it works if I use these commands in my .zshrc:



                      precmd () {print -Pn "e]2; %~/ a"}
                      preexec () {print -Pn "e]2; %~/ a"}


                      it is also possible to use PS1 (for Bash, from this wiki):



                      export PS1="[e]2;u@H wae[32;1m]>[e[0m] "


                      where e]2; is the escape sequence to print things in the titlebar. It seems that Terminal.app is getting its information from there.



                      More information:




                      • http://networking.ringofsaturn.com/Unix/Bash-prompts.php

                      • http://www.funtoo.org/wiki/Prompt_Magic

                      • http://tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html






                      share|improve this answer





















                      • also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
                        – Tim
                        Aug 8 '11 at 7:18










                      • As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
                        – Chris Page
                        Mar 10 '12 at 22:04








                      • 2




                        The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
                        – Chris Page
                        Mar 10 '12 at 22:29






                      • 3




                        Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
                        – Nick
                        Apr 18 '12 at 15:53






                      • 1




                        I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
                        – mareoraft
                        Dec 18 '15 at 23:41















                      up vote
                      21
                      down vote













                      Another option now available in Mac OS X Lion is using the built-in feature. It uses 'escape sequences' to find out the current directory. For me it works if I use these commands in my .zshrc:



                      precmd () {print -Pn "e]2; %~/ a"}
                      preexec () {print -Pn "e]2; %~/ a"}


                      it is also possible to use PS1 (for Bash, from this wiki):



                      export PS1="[e]2;u@H wae[32;1m]>[e[0m] "


                      where e]2; is the escape sequence to print things in the titlebar. It seems that Terminal.app is getting its information from there.



                      More information:




                      • http://networking.ringofsaturn.com/Unix/Bash-prompts.php

                      • http://www.funtoo.org/wiki/Prompt_Magic

                      • http://tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html






                      share|improve this answer





















                      • also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
                        – Tim
                        Aug 8 '11 at 7:18










                      • As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
                        – Chris Page
                        Mar 10 '12 at 22:04








                      • 2




                        The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
                        – Chris Page
                        Mar 10 '12 at 22:29






                      • 3




                        Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
                        – Nick
                        Apr 18 '12 at 15:53






                      • 1




                        I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
                        – mareoraft
                        Dec 18 '15 at 23:41













                      up vote
                      21
                      down vote










                      up vote
                      21
                      down vote









                      Another option now available in Mac OS X Lion is using the built-in feature. It uses 'escape sequences' to find out the current directory. For me it works if I use these commands in my .zshrc:



                      precmd () {print -Pn "e]2; %~/ a"}
                      preexec () {print -Pn "e]2; %~/ a"}


                      it is also possible to use PS1 (for Bash, from this wiki):



                      export PS1="[e]2;u@H wae[32;1m]>[e[0m] "


                      where e]2; is the escape sequence to print things in the titlebar. It seems that Terminal.app is getting its information from there.



                      More information:




                      • http://networking.ringofsaturn.com/Unix/Bash-prompts.php

                      • http://www.funtoo.org/wiki/Prompt_Magic

                      • http://tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html






                      share|improve this answer












                      Another option now available in Mac OS X Lion is using the built-in feature. It uses 'escape sequences' to find out the current directory. For me it works if I use these commands in my .zshrc:



                      precmd () {print -Pn "e]2; %~/ a"}
                      preexec () {print -Pn "e]2; %~/ a"}


                      it is also possible to use PS1 (for Bash, from this wiki):



                      export PS1="[e]2;u@H wae[32;1m]>[e[0m] "


                      where e]2; is the escape sequence to print things in the titlebar. It seems that Terminal.app is getting its information from there.



                      More information:




                      • http://networking.ringofsaturn.com/Unix/Bash-prompts.php

                      • http://www.funtoo.org/wiki/Prompt_Magic

                      • http://tldp.org/HOWTO/Bash-Prompt-HOWTO/xterm-title-bar-manipulations.html







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jul 21 '11 at 9:42









                      Tim

                      1,36321322




                      1,36321322












                      • also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
                        – Tim
                        Aug 8 '11 at 7:18










                      • As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
                        – Chris Page
                        Mar 10 '12 at 22:04








                      • 2




                        The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
                        – Chris Page
                        Mar 10 '12 at 22:29






                      • 3




                        Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
                        – Nick
                        Apr 18 '12 at 15:53






                      • 1




                        I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
                        – mareoraft
                        Dec 18 '15 at 23:41


















                      • also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
                        – Tim
                        Aug 8 '11 at 7:18










                      • As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
                        – Chris Page
                        Mar 10 '12 at 22:04








                      • 2




                        The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
                        – Chris Page
                        Mar 10 '12 at 22:29






                      • 3




                        Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
                        – Nick
                        Apr 18 '12 at 15:53






                      • 1




                        I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
                        – mareoraft
                        Dec 18 '15 at 23:41
















                      also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
                      – Tim
                      Aug 8 '11 at 7:18




                      also, I think oh-my-zsh has this by default. I've been using this for a week or so now and it works pretty much out of the box.
                      – Tim
                      Aug 8 '11 at 7:18












                      As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
                      – Chris Page
                      Mar 10 '12 at 22:04






                      As of Mac OS X Lion 10.7, Terminal will display the working directory using the “proxy” icon in the title bar, has options to create new terminals at the same directory, and supports Resuming terminals. As a convenience, Terminal will look at the contents of the window/tab titles to see if they contain a valid pathname. However, in /etc/bashrc you’ll see that it also supports a new escape code for informing Terminal of the working directory using a file: URL, which can handle all valid pathnames via percent-encoding (the window/tab titles can only contain a subset of ASCII characters).
                      – Chris Page
                      Mar 10 '12 at 22:04






                      2




                      2




                      The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
                      – Chris Page
                      Mar 10 '12 at 22:29




                      The escape sequence for setting the working directory is the same basic code as for setting the titles—Operating System Command (OSC)—with code 7 instead of 0-2: e]7;file://hostname/percent-encoded-pathnamea
                      – Chris Page
                      Mar 10 '12 at 22:29




                      3




                      3




                      Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
                      – Nick
                      Apr 18 '12 at 15:53




                      Why use precmd and preexec? Why not just chpwd () {print -Pn "e]2; %~/ a"}?
                      – Nick
                      Apr 18 '12 at 15:53




                      1




                      1




                      I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
                      – mareoraft
                      Dec 18 '15 at 23:41




                      I understand how this updates the titlebar, but I don't understand how this causes a new tab to open in the same directory as the previous tab.
                      – mareoraft
                      Dec 18 '15 at 23:41










                      up vote
                      3
                      down vote













                      This is a very simple version which I used in bash and also works in zsh.
                      It saves the current folder in a file, after every command (Doesn't hurt too much IMO)
                      and opens a new terminal in the saved current folder.



                      add the following to .zshrc



                      # emulate bash PROMPT_COMMAND (only for zsh)
                      precmd() { eval "$PROMPT_COMMAND" }
                      # open new terminal in same dir
                      PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
                      [[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"





                      share|improve this answer





















                      • This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
                        – mareoraft
                        Dec 18 '15 at 23:46















                      up vote
                      3
                      down vote













                      This is a very simple version which I used in bash and also works in zsh.
                      It saves the current folder in a file, after every command (Doesn't hurt too much IMO)
                      and opens a new terminal in the saved current folder.



                      add the following to .zshrc



                      # emulate bash PROMPT_COMMAND (only for zsh)
                      precmd() { eval "$PROMPT_COMMAND" }
                      # open new terminal in same dir
                      PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
                      [[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"





                      share|improve this answer





















                      • This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
                        – mareoraft
                        Dec 18 '15 at 23:46













                      up vote
                      3
                      down vote










                      up vote
                      3
                      down vote









                      This is a very simple version which I used in bash and also works in zsh.
                      It saves the current folder in a file, after every command (Doesn't hurt too much IMO)
                      and opens a new terminal in the saved current folder.



                      add the following to .zshrc



                      # emulate bash PROMPT_COMMAND (only for zsh)
                      precmd() { eval "$PROMPT_COMMAND" }
                      # open new terminal in same dir
                      PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
                      [[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"





                      share|improve this answer












                      This is a very simple version which I used in bash and also works in zsh.
                      It saves the current folder in a file, after every command (Doesn't hurt too much IMO)
                      and opens a new terminal in the saved current folder.



                      add the following to .zshrc



                      # emulate bash PROMPT_COMMAND (only for zsh)
                      precmd() { eval "$PROMPT_COMMAND" }
                      # open new terminal in same dir
                      PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
                      [[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"






                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Sep 30 '14 at 10:22









                      superbly

                      1364




                      1364












                      • This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
                        – mareoraft
                        Dec 18 '15 at 23:46


















                      • This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
                        – mareoraft
                        Dec 18 '15 at 23:46
















                      This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
                      – mareoraft
                      Dec 18 '15 at 23:46




                      This is cool but requires you to actually execute a command in a tab to update. This can in rare cases cause unexpected behavior. Maybe there is a different function we can use that gets triggered when you switch tabs instead of run a command?
                      – mareoraft
                      Dec 18 '15 at 23:46










                      up vote
                      1
                      down vote













                      gdirs seems like a way to almost do it: new tab, then gdirs to select the deep directory and voila.
                      My first idea was to make the directory stack shared among all tabs and do cd ~1 after the new tab, but I cannot find how to do that, as it seems each instance of zsh keeps its own. History sharing goes via a common file, so maybe that could be done here too...






                      share|improve this answer

























                        up vote
                        1
                        down vote













                        gdirs seems like a way to almost do it: new tab, then gdirs to select the deep directory and voila.
                        My first idea was to make the directory stack shared among all tabs and do cd ~1 after the new tab, but I cannot find how to do that, as it seems each instance of zsh keeps its own. History sharing goes via a common file, so maybe that could be done here too...






                        share|improve this answer























                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          gdirs seems like a way to almost do it: new tab, then gdirs to select the deep directory and voila.
                          My first idea was to make the directory stack shared among all tabs and do cd ~1 after the new tab, but I cannot find how to do that, as it seems each instance of zsh keeps its own. History sharing goes via a common file, so maybe that could be done here too...






                          share|improve this answer












                          gdirs seems like a way to almost do it: new tab, then gdirs to select the deep directory and voila.
                          My first idea was to make the directory stack shared among all tabs and do cd ~1 after the new tab, but I cannot find how to do that, as it seems each instance of zsh keeps its own. History sharing goes via a common file, so maybe that could be done here too...







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Jan 22 '11 at 17:42









                          Henno

                          64945




                          64945






















                              up vote
                              0
                              down vote













                              This is how you do it in bash.



                              This shell script will tell (quiet literally, using Applescript) Terminal.app to open a new tab then switch to the current directory:



                              #!/bin/bash
                              osascript -e 'tell application "Terminal"'
                              -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
                              -e "do script with command "cd `pwd`;clear" in selected tab of the front window"
                              -e 'end tell' &> /dev/null


                              … put the above shell script in a directory in your $PATH (i.e. /usr/local/bin) and make sure it’s executable:



                              $ chmod +x /usr/local/bin/nt


                              (source)






                              share|improve this answer





















                              • Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
                                – Chris Page
                                Mar 10 '12 at 22:22















                              up vote
                              0
                              down vote













                              This is how you do it in bash.



                              This shell script will tell (quiet literally, using Applescript) Terminal.app to open a new tab then switch to the current directory:



                              #!/bin/bash
                              osascript -e 'tell application "Terminal"'
                              -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
                              -e "do script with command "cd `pwd`;clear" in selected tab of the front window"
                              -e 'end tell' &> /dev/null


                              … put the above shell script in a directory in your $PATH (i.e. /usr/local/bin) and make sure it’s executable:



                              $ chmod +x /usr/local/bin/nt


                              (source)






                              share|improve this answer





















                              • Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
                                – Chris Page
                                Mar 10 '12 at 22:22













                              up vote
                              0
                              down vote










                              up vote
                              0
                              down vote









                              This is how you do it in bash.



                              This shell script will tell (quiet literally, using Applescript) Terminal.app to open a new tab then switch to the current directory:



                              #!/bin/bash
                              osascript -e 'tell application "Terminal"'
                              -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
                              -e "do script with command "cd `pwd`;clear" in selected tab of the front window"
                              -e 'end tell' &> /dev/null


                              … put the above shell script in a directory in your $PATH (i.e. /usr/local/bin) and make sure it’s executable:



                              $ chmod +x /usr/local/bin/nt


                              (source)






                              share|improve this answer












                              This is how you do it in bash.



                              This shell script will tell (quiet literally, using Applescript) Terminal.app to open a new tab then switch to the current directory:



                              #!/bin/bash
                              osascript -e 'tell application "Terminal"'
                              -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'
                              -e "do script with command "cd `pwd`;clear" in selected tab of the front window"
                              -e 'end tell' &> /dev/null


                              … put the above shell script in a directory in your $PATH (i.e. /usr/local/bin) and make sure it’s executable:



                              $ chmod +x /usr/local/bin/nt


                              (source)







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jan 13 '11 at 18:44









                              Nifle

                              27.8k2393128




                              27.8k2393128












                              • Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
                                – Chris Page
                                Mar 10 '12 at 22:22


















                              • Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
                                – Chris Page
                                Mar 10 '12 at 22:22
















                              Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
                              – Chris Page
                              Mar 10 '12 at 22:22




                              Note that as of Mac OS X Lion 10.7, by default Terminal will start new tabs in the same working directory as the previous tab. So you only need to arrange to create the tab now. (If you’re using bash. If you’re using another shell, look at the code in /etc/bashrc for how to tell Terminal about the current working directory.)
                              – Chris Page
                              Mar 10 '12 at 22:22










                              up vote
                              0
                              down vote













                              If you need to open this new tab right now, without changing your config files or installing new plugins, run this:



                              pwd | pbcopy


                              Then open a new Terminal tab manually (with ⌘T), and in the new tab:



                              cd "`pbpaste`"


                              Warning: this will overwrite the contents of the system clipboard.





                              An alternative, longer method that does not overwrite the clipboard:



                              pwd > $TMPDIR/wd


                              Open your new tab.



                              cd "$(cat $TMPDIR/wd)"
                              rm -f $TMPDIR/wd





                              share|improve this answer



























                                up vote
                                0
                                down vote













                                If you need to open this new tab right now, without changing your config files or installing new plugins, run this:



                                pwd | pbcopy


                                Then open a new Terminal tab manually (with ⌘T), and in the new tab:



                                cd "`pbpaste`"


                                Warning: this will overwrite the contents of the system clipboard.





                                An alternative, longer method that does not overwrite the clipboard:



                                pwd > $TMPDIR/wd


                                Open your new tab.



                                cd "$(cat $TMPDIR/wd)"
                                rm -f $TMPDIR/wd





                                share|improve this answer

























                                  up vote
                                  0
                                  down vote










                                  up vote
                                  0
                                  down vote









                                  If you need to open this new tab right now, without changing your config files or installing new plugins, run this:



                                  pwd | pbcopy


                                  Then open a new Terminal tab manually (with ⌘T), and in the new tab:



                                  cd "`pbpaste`"


                                  Warning: this will overwrite the contents of the system clipboard.





                                  An alternative, longer method that does not overwrite the clipboard:



                                  pwd > $TMPDIR/wd


                                  Open your new tab.



                                  cd "$(cat $TMPDIR/wd)"
                                  rm -f $TMPDIR/wd





                                  share|improve this answer














                                  If you need to open this new tab right now, without changing your config files or installing new plugins, run this:



                                  pwd | pbcopy


                                  Then open a new Terminal tab manually (with ⌘T), and in the new tab:



                                  cd "`pbpaste`"


                                  Warning: this will overwrite the contents of the system clipboard.





                                  An alternative, longer method that does not overwrite the clipboard:



                                  pwd > $TMPDIR/wd


                                  Open your new tab.



                                  cd "$(cat $TMPDIR/wd)"
                                  rm -f $TMPDIR/wd






                                  share|improve this answer














                                  share|improve this answer



                                  share|improve this answer








                                  edited Mar 13 '13 at 9:36

























                                  answered Mar 7 '13 at 8:48









                                  Rory O'Kane

                                  6201518




                                  6201518






















                                      up vote
                                      0
                                      down vote













                                      Per Pieter's comment above, once the plugins=(git osx) plugins are installed, you can just type tab and it will open a new tab in your current directory.






                                      share|improve this answer

























                                        up vote
                                        0
                                        down vote













                                        Per Pieter's comment above, once the plugins=(git osx) plugins are installed, you can just type tab and it will open a new tab in your current directory.






                                        share|improve this answer























                                          up vote
                                          0
                                          down vote










                                          up vote
                                          0
                                          down vote









                                          Per Pieter's comment above, once the plugins=(git osx) plugins are installed, you can just type tab and it will open a new tab in your current directory.






                                          share|improve this answer












                                          Per Pieter's comment above, once the plugins=(git osx) plugins are installed, you can just type tab and it will open a new tab in your current directory.







                                          share|improve this answer












                                          share|improve this answer



                                          share|improve this answer










                                          answered Mar 2 '14 at 1:53









                                          Case

                                          1112




                                          1112






















                                              up vote
                                              0
                                              down vote













                                              If you want the directory to change automatically when a new tab is opened use the dirpersist plugin.



                                              The osx plugin only does save the last directory but you have to run the command tab to open a new tab, which is not always possible (if, say, you're running something in your current tab).






                                              share|improve this answer

























                                                up vote
                                                0
                                                down vote













                                                If you want the directory to change automatically when a new tab is opened use the dirpersist plugin.



                                                The osx plugin only does save the last directory but you have to run the command tab to open a new tab, which is not always possible (if, say, you're running something in your current tab).






                                                share|improve this answer























                                                  up vote
                                                  0
                                                  down vote










                                                  up vote
                                                  0
                                                  down vote









                                                  If you want the directory to change automatically when a new tab is opened use the dirpersist plugin.



                                                  The osx plugin only does save the last directory but you have to run the command tab to open a new tab, which is not always possible (if, say, you're running something in your current tab).






                                                  share|improve this answer












                                                  If you want the directory to change automatically when a new tab is opened use the dirpersist plugin.



                                                  The osx plugin only does save the last directory but you have to run the command tab to open a new tab, which is not always possible (if, say, you're running something in your current tab).







                                                  share|improve this answer












                                                  share|improve this answer



                                                  share|improve this answer










                                                  answered Apr 16 '14 at 18:26









                                                  garageàtrois

                                                  1513




                                                  1513






















                                                      up vote
                                                      0
                                                      down vote













                                                      Adding terminalapp to .zshrc didn't work for me so I looked for the plugin ~/.oh-my-zsh/plugins/terminalapp and it tells me:



                                                      # This file is intentionally empty.
                                                      #
                                                      # The terminalapp plugin is deprecated and may be removed in a future release.
                                                      # Its functionality has been folded in to the core lib/termsupport.zsh, which
                                                      # is loaded for all users. You can remove terminalapp from your $plugins list
                                                      # once all your systems are updated to the current version of Oh My Zsh.





                                                      share|improve this answer



























                                                        up vote
                                                        0
                                                        down vote













                                                        Adding terminalapp to .zshrc didn't work for me so I looked for the plugin ~/.oh-my-zsh/plugins/terminalapp and it tells me:



                                                        # This file is intentionally empty.
                                                        #
                                                        # The terminalapp plugin is deprecated and may be removed in a future release.
                                                        # Its functionality has been folded in to the core lib/termsupport.zsh, which
                                                        # is loaded for all users. You can remove terminalapp from your $plugins list
                                                        # once all your systems are updated to the current version of Oh My Zsh.





                                                        share|improve this answer

























                                                          up vote
                                                          0
                                                          down vote










                                                          up vote
                                                          0
                                                          down vote









                                                          Adding terminalapp to .zshrc didn't work for me so I looked for the plugin ~/.oh-my-zsh/plugins/terminalapp and it tells me:



                                                          # This file is intentionally empty.
                                                          #
                                                          # The terminalapp plugin is deprecated and may be removed in a future release.
                                                          # Its functionality has been folded in to the core lib/termsupport.zsh, which
                                                          # is loaded for all users. You can remove terminalapp from your $plugins list
                                                          # once all your systems are updated to the current version of Oh My Zsh.





                                                          share|improve this answer














                                                          Adding terminalapp to .zshrc didn't work for me so I looked for the plugin ~/.oh-my-zsh/plugins/terminalapp and it tells me:



                                                          # This file is intentionally empty.
                                                          #
                                                          # The terminalapp plugin is deprecated and may be removed in a future release.
                                                          # Its functionality has been folded in to the core lib/termsupport.zsh, which
                                                          # is loaded for all users. You can remove terminalapp from your $plugins list
                                                          # once all your systems are updated to the current version of Oh My Zsh.






                                                          share|improve this answer














                                                          share|improve this answer



                                                          share|improve this answer








                                                          edited Jan 23 '16 at 16:46









                                                          DavidPostill

                                                          102k25216252




                                                          102k25216252










                                                          answered Jan 23 '16 at 13:14









                                                          Steve Root

                                                          11




                                                          11






















                                                              up vote
                                                              0
                                                              down vote













                                                              New tabs already open in the same folder (Cmd+T).
                                                              For new windows (Cmd+N) the solution from Pieter is right:




                                                              Preferences > Profiles > Default > General > Working Directory > Reuse
                                                              previous session's directory option







                                                              share|improve this answer








                                                              New contributor




                                                              Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                              Check out our Code of Conduct.






















                                                                up vote
                                                                0
                                                                down vote













                                                                New tabs already open in the same folder (Cmd+T).
                                                                For new windows (Cmd+N) the solution from Pieter is right:




                                                                Preferences > Profiles > Default > General > Working Directory > Reuse
                                                                previous session's directory option







                                                                share|improve this answer








                                                                New contributor




                                                                Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                Check out our Code of Conduct.




















                                                                  up vote
                                                                  0
                                                                  down vote










                                                                  up vote
                                                                  0
                                                                  down vote









                                                                  New tabs already open in the same folder (Cmd+T).
                                                                  For new windows (Cmd+N) the solution from Pieter is right:




                                                                  Preferences > Profiles > Default > General > Working Directory > Reuse
                                                                  previous session's directory option







                                                                  share|improve this answer








                                                                  New contributor




                                                                  Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.









                                                                  New tabs already open in the same folder (Cmd+T).
                                                                  For new windows (Cmd+N) the solution from Pieter is right:




                                                                  Preferences > Profiles > Default > General > Working Directory > Reuse
                                                                  previous session's directory option








                                                                  share|improve this answer








                                                                  New contributor




                                                                  Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.









                                                                  share|improve this answer



                                                                  share|improve this answer






                                                                  New contributor




                                                                  Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.









                                                                  answered Nov 21 at 7:12









                                                                  Punnerud

                                                                  101




                                                                  101




                                                                  New contributor




                                                                  Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.





                                                                  New contributor





                                                                  Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.






                                                                  Punnerud is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                                                                  Check out our Code of Conduct.






























                                                                       

                                                                      draft saved


                                                                      draft discarded



















































                                                                       


                                                                      draft saved


                                                                      draft discarded














                                                                      StackExchange.ready(
                                                                      function () {
                                                                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f232835%2fopen-a-new-tab-in-the-same-directory%23new-answer', 'question_page');
                                                                      }
                                                                      );

                                                                      Post as a guest















                                                                      Required, but never shown





















































                                                                      Required, but never shown














                                                                      Required, but never shown












                                                                      Required, but never shown







                                                                      Required, but never shown

































                                                                      Required, but never shown














                                                                      Required, but never shown












                                                                      Required, but never shown







                                                                      Required, but never shown







                                                                      Popular posts from this blog

                                                                      "Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

                                                                      Alcedinidae

                                                                      RAC Tourist Trophy