tmux essentials for persistent terminal sessions
TIL
·
September 12, 2025
·
1 min read
tmux keeps your terminal sessions alive when you disconnect.
Install#
# macOS
brew install tmux
# Ubuntu/Debian
sudo apt install tmux Core concepts#
Session : A collection of windows, persists after disconnect
Window : A full-screen tab within a session
Pane : A split within a window
Essential commands#
All tmux commands start with the prefix Ctrl+b, then a key.
Action Command
New session tmux new -s myproject
Detach Ctrl+b d
List sessions tmux ls
Attach tmux attach -t myproject
Kill session tmux kill-session -t myproject
Window management#
Action Command
New window Ctrl+b c
Next window Ctrl+b n
Previous window Ctrl+b p
Rename window Ctrl+b ,
Pane splitting#
Action Command
Split vertical Ctrl+b %
Split horizontal Ctrl+b "
Navigate panes Ctrl+b arrow
Close pane Ctrl+d or exit
Typical workflow#
# Start a named session
tmux new -s dev
# Run your process (e.g., a build server)
npm run dev
# Detach with Ctrl+b d
# Log out, go home, whatever
# Later, reattach
tmux attach -t dev
# Your process is still running