When I start tmux the first time after a reboot, the default directory is '/' (also newly created tmux tabs have this default directory) and in the place of the tmux session number ('0' in the picture) it shows 'root' instead.

Destroying the tmux session and opening a new one resolves the issue and new tmux sessions and tabs open in my home directory (as shown in the picture).

What could possibly cause this mistake and what could be the reason of the error-rescuing upon a second run of tmux?

Example tmux session upon second run (home directory and session number shown correctly)

I am using the tmux plugin from zsh. Thus tmux is aliased to _zsh_tmux_plugin_run which does:

if [[ -n "$@" ]]; then
                command tmux "$@"
                return $?
        local -a tmux_cmd
        tmux_cmd=(command tmux)
        [[ "$ZSH_TMUX_ITERM2" == "true" ]] && tmux_cmd+=(-CC)
        [[ "$ZSH_TMUX_AUTOCONNECT" == "true" ]] && $tmux_cmd attach
        if [[ $? -ne 0 ]]
                [[ "$ZSH_TMUX_FIXTERM" == "true" ]] && tmux_cmd+=(-f "$_ZSH_TMUX_FIXED_CONFIG")
                $tmux_cmd new-session
        if [[ "$ZSH_TMUX_AUTOQUIT" == "true" ]]
  • What version of tmux do you have? Also it may be caused by your configuration, did you tried running as tmux -f /dev/null (note that it may not work if you have another session opened) – cevhyruz May 1 at 4:55
  • The only way for the session name to be non-numeric is if you pass -s to new-session. How are you starting tmux? – Nicholas Marriott May 1 at 5:39
  • I am using the tmux plugin from zsh, I updated the question to show how it is started – moritzschaefer May 6 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.