Command lineeasyBash

Tmux Session Management

Essential tmux commands for managing multiple terminal sessions and windows.

01

The problem

You need to manage multiple terminal sessions and preserve work across disconnections.

02

The solution

Bash
# Start new tmux session
tmux new -s session_name

# Detach from session (Ctrl+b d)
tmux detach

# List sessions
tmux ls

# Attach to existing session
tmux attach -t session_name

# Kill session
tmux kill-session -t session_name

# Split pane horizontally (Ctrl+b ")
tmux split-window

# Split pane vertically (Ctrl+b %)
tmux split-window -h

# Navigate panes (Ctrl+b arrow keys)
tmux select-pane -U  # Up
tmux select-pane -D  # Down

# Create new window (Ctrl+b c)
tmux new-window

# Rename window (Ctrl+b ,)
tmux rename-window new_name

03

Put it to work

Example
# Start development session
tmux new -s dev

# Split for code editor and server
# Ctrl+b " for horizontal split
# Ctrl+b % for vertical split

# Detach and reconnect later
tmux attach -t dev

Worth knowing

Tmux sessions persist even when disconnected. Use prefix key (Ctrl+b) before commands.