I am trying to create a new window in a tmux-session and split it (and afterwards I hope that it'll be possible to execute some commands in the splitted window). Therefore, I'd like to use new-window, which should, according to the manpage, support something like new-window 'vi /etc/passwd'. Executing tmux new-window in an existing session works fine.

Unfortunately, when I open tmux, and run tmux new-window 'tmux split-window' or even tmux new-window 'echo test', the command is not executed at all. Other parameters, like tmux new-window -c "~" work like expected. A little workaround, nameley using tmux new-window -t 4 && tmux split-window -t 4 does work, but requires an index.

Why is it not possible to split a pane or just give it an command to execute?

2 Answers 2


Try, from the command-line:

tmux new-window \; split-window

The reason that your command tmux new-window 'echo test' didn't work as you expected is that by default tmux closes the window upon completion of the shell-command. To see for yourself, try instead tmux new-window top. There does exist a tmux option remain-on-exit that supposedly can be set on a per-session or per-window basis, but I haven't had success using it. Refer to the man page for details.


You can try using tmux shortcuts. Start with the tmux prefix, usually Ctrl + b then:

% for vertical split

" for horizontal split.

To swap panes use o or the arrows.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .