Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Say my present working directory is /home/abc/documents/xyz. Now in tmux, when I split my screen, the new pane defaults to the /home/abc directory. I want the pwd to be retained upon splitting.

share|improve this question
Similair question on, describes how to open new window while retaining the current pwd – bbaja42 Jun 25 '11 at 21:24
up vote 0 down vote accepted

You can put something like the following in your tmux.conf file:

bind <key of your choice> default-path $(pwd) \; split-window\; set default-path ~/

This binds to the chosen or a command which changes the default path for new panes to the current directory of the current pane (via the output of pwd) and then splits the pane, and then binds it back to home.

I read this trick on ArchWiki a while back. There's another more in-depth method that uses cd if you follow the link, though it has its own issues so I'd personally recommend sticking with what's shown above.

share|improve this answer
The tip you linked to works when it is executed from a shell command line because the shell expands the $() command substitution. However, this same command cannot actually “be easily bound to a key” because tmux does not do command substitution for the value given to set default-path (even if it did, the effective cwd would be that of the server, not that of the foreground process of the active pane). – Chris Johnsen Dec 9 '11 at 6:17
Also, there really is no need to even mess with default-path for the case of creating a pane/window with the same cwd as an existing shell because tmux split-window/tmux new-window from (e.g.) a shell will pass its cwd (inherited from its parent, (e.g.) the shell) to the process started for the new pane. – Chris Johnsen Dec 9 '11 at 6:42
A note since I'm not allowed to make that small of an edit: the first default-path above should be set default-path. – Henrik N Feb 28 '12 at 22:14

The default-path described on a previous answer is no longer a compatible, this behavior was changed from tmux 1.8 to tmux 1.9.

The way to do this now is to have binds that do neww -c '#{pane_current_path}' or the same with split-window.

Please refer to the changes exposed here: , in the section that reads CHANGES FROM 1.8 to 1.9, 20 February 2014.

share|improve this answer

theres a zsh-plugin for that

coincidentally I have this behaviour via a ssh:ed session but I don't know what setting this is.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.