Use the -L
flag to create separate tmux servers with different socket names: tmux -L work new-session
creates a "work" server independent from your default tmux server.
tmux -L work new-session -s main
Multiple tmux servers allow you to completely isolate different environments or projects. Each server maintains its own sessions, windows, and panes independently, using different socket files for communication.
# Create separate servers tmux -L work new-session -s main tmux -L personal new-session -s home # List sessions on specific servers tmux -L work list-sessions tmux -L personal list-sessions # Attach to specific server tmux -L work attach-session -t main
Create shell aliases for quick access to different tmux servers:
# Add to your shell config (~/.zshrc, ~/.bashrc) alias work='tmux -L work' alias personal='tmux -L personal' # Usage work new-session -s project1 personal attach-session -t home
Each server creates its socket in /tmp/tmux-{uid}/{socket-name}
. You can also specify custom socket paths with -S /path/to/socket
.