Create New Tab Sessions with the same working Directory

ItermIterm2

Iterm Problem Overview


Often in workflow you are working within a directory and then need to create a second terminal or session to the same directory.

TAB 1
#~/home
cd really
#~/home/really
cd long
#~/home/really/long
cd filepath
#~/home/really/long/filepath
node filepath
#session now occupied 

#new TAB
#CTR + T
#~/home
#I want to be in the same filepath 

is there a setting somewhere to do this?

Iterm Solutions


Solution 1 - Iterm

One of the options for a profile is which directory to use when creating a session with that profile. The default is to use your home directory, but you can change that to use the previous directory instead. You can change this setting in the default profile (allowing you to continue using -T), or you can create a new profile which uses this setting, and assign a different keyboard shortcut to create a session with that profile.

Solution 2 - Iterm

Preferences->Profiles->Working Directory->Reuse previous session's directory

Solution 3 - Iterm

To open new tab with same directory we can do this.

shift + cmommand + D 

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionStanleyZhengView Question on Stackoverflow
Solution 1 - ItermchepnerView Answer on Stackoverflow
Solution 2 - ItermJialinView Answer on Stackoverflow
Solution 3 - ItermAmrit DhunganaView Answer on Stackoverflow