When I run tmux new-window from a script outside of my current tmux session, how can I specify which session the new window should be associated with?

2 Answers 2


Though not very clearly documented, it turns out windows can be specified as session-name:window-number, so specifying tmux new-window -t SESSION: results in creating a new window in the session. The session name or default number may be used.


Just improving @David's answer, because it wan't very clear for me and I spent some time investigating this.

Suppose, we created a session and a window with this command:

tmux new-session -d -s my-session-1 -n my-window-1 'sleep 10000'

To add a new window into it:

tmux new-window -n my-window-2 -t my-session-1: 'sleep 10000'

(notice the colon after the session name)

You must log in to answer this question.

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