Hopefully the title of this post is descriptive enough.

As well-documented in the tmux manuals, tmux launches a login shell every time a new tmux window or pane (split) is launched.

Instead, how can I configure tmux to launch just one login shell per session (maybe the first window), and any subsequent window/pane created shall be a non-login shell?

If this is not possible, at least can I configure tmux such that when launching the server, it will read ~/.bash_profile or ~/.profile, but any window launched within tmux shall be a normal (non-login) shell?

1 Answer 1


You can use a wrapper script for the Tmux default-command option. I've been successfully using the following arrangement for a while:

  • Put the following script somewhere in PATH, e.g. /usr/local/bin/tmux-default-command

    default_shell=$(tmux show-options -gqv default-shell)
    current_window=$(tmux display-message -p '#I')
    if [ "$current_window" = "0" ]; then
        tmux rename-window "Hello" && exec "$default_shell" -l
        exec "$default_shell"
  • In the Tmux configuration

    default-shell   = '/bin/bash' # optional
    default-command = 'tmux-default-command'


You must log in to answer this question.

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