Script Valley
Developer Environment Setup (WSL, Terminal, VS Code)
Shell Configuration and ProductivityLesson 3.4

How to use tmux to manage multiple terminal sessions

tmux installation, sessions vs windows vs panes, prefix key, creating splits, switching panes, detach and reattach, named sessions, basic tmux config

tmux for Terminal Multiplexing

tmux session window pane hierarchy

tmux lets you split one terminal into multiple panes, run background processes that survive closed windows, and manage long-running jobs during remote sessions.

Install and start

sudo apt install tmux -y
tmux
tmux new -s dev

Key bindings (prefix is Ctrl+B)

Ctrl+B %     # split vertically
Ctrl+B "     # split horizontally
Ctrl+B o     # switch to next pane
Ctrl+B x     # close current pane
Ctrl+B d     # detach from session

Detach and reattach

tmux ls
tmux attach -t dev

Detaching is powerful for long-running tasks: start a build, detach, close the terminal, come back later and reattach to see the output.

Basic .tmux.conf

set -g mouse on
set -g history-limit 10000

Reload config: tmux source-file ~/.tmux.conf

Up next

How to use shell history and keyboard shortcuts to work faster

Sign in to track progress