I often want to start a persistent process from a particular directory and be able to monitor it, while still keeping a command line in that directory for other commands. My current workflow is to cmd + shift + d
to split panes, but the cwd of the new pane is back at home, and I need to cd back to where I was. Is there a good way to split panes and automatically set cwd of the new pane to the same directory as the pane it was split from?
Asked
Active
Viewed 1,259 times
8

IanVS
- 3,497
- 1
- 20
- 23
2 Answers
13
lanVS's solution works out, but there may be a side effect that you don't want: If you open new tab/windows, it will reuse previous session's directory.
So if you just want the new split pane to act like that, you can do that:
- open "Preferences", select "Profiles"
- select the profile you want to change
- go to "General" subtab
- set Working Directory to "Advanced Configuration"
- click "Edit..."
- select "Reuse previous session's directory" for option "Working Directory for New Split Panes"
2
I found the answer from http://teohm.com/blog/2012/03/22/working-effectively-with-iterm2/:
Open tab/pane with current working directory
Under Profiles tab, go to General subtab, set Working Directory to “Reuse previous session’s directory”.