How to change default new window directory from within the tmux

  1. Start tmux as follows:

    (cd /aaa/bbb; tmux)
    

    Now, any new windows (or panes) you create will start in directory /aaa/bbb, regardless of the current directory of the current pane.

  2. If you want to change the default directory once tmux is up and running, use attach-session with -c.

    Quoting from the tmux man page for attach-session:

    -c will set the session working directory (used for new windows)
    to working-directory.
    

    For example:

    • Ctrl+b :

    • attach -c /ddd/eee

    New windows (or panes) will now start in directory /ddd/eee, regardless of the directory of the current pane.


For those who might be looking for a bit more reference than the selected answer provides, there was an another good answer to this question over on StackOverflow:

https://stackoverflow.com/questions/27307815/how-to-change-the-starting-directory-of-a-tmux-session

Which provides ways you can do it without leaving the session, and for those who use tmux in a multi-session fashion (like myself), the above answer gives a bit better context as to how attach/attach-session works.

See both available answers for different ways they can be used. I found both to be helpful/insightful.