Tmux failed to connect to server error on `tmux ls` when there are no running sessions
Just writing a quick loop to list out existing tmux sessions when I log into a server, depending on whether tmux is installed (via .bashrc on CentOS). if rpm -q tmux; then echo -e "TMUX sessions running:\n" echo `tmux ls` fi This works great when tmux has a session or two, but if there are no running tmux sessions, I'm getting failed to connect to server: No such file or directory . Is there a way to suppress this? Thanks! Note that you may have a tmux server running, but you cannot connect to it because someone cleaned out the /tmp directory and took the server's socket with it. In that case,