Skip to main content

Windows Basics

Windows in tmux are like browser tabs: each one fills the whole terminal area and runs independent shell processes.

Learning Focus

Use this lesson to get comfortable creating, switching, and naming windows for organized multi-task workflows.

Creating Windows

Default ShortcutModification ShortcutAction
Ctrl+b cCtrl+Space WNew window (auto-numbered)

From the command line:

tmux new-window -t work -n "logs"
tmux new-window -t work:3 -n "deploy" # at specific index

Window Naming

By default, windows show the current command name. Rename them to be descriptive:

Default ShortcutModification ShortcutAction
Ctrl+b ,Prefix e wRename current window

Or from command line:

tmux rename-window -t work:0 "editor"
tmux rename-window -t work:1 "server"
Default ShortcutModification ShortcutAction
Ctrl+b nAlt+PageDownNext window
Ctrl+b pAlt+PageUpPrevious window
Ctrl+b 0-9Alt+1/2/3 or Ctrl+Space 0-9Jump to window by number
Ctrl+b wCtrl+Space wInteractive window list
Ctrl+b lCtrl+Space lLast (previously active) window
Ctrl+b 'Ctrl+Space 'Prompt for window index

Moving and Reordering Windows

# swap window 1 and window 3
tmux swap-window -s 1 -t 3

# move window to index 0
tmux move-window -t 0
Default ShortcutModification ShortcutAction
Ctrl+b .Ctrl+Space .Prompt to move window to a new index

Closing Windows

# close current window — exit all panes
exit

# force kill from outside
tmux kill-window -t work:2
note

A window closes automatically when all panes inside it exit.

Monitoring Windows

Tmux can alert you when activity happens in a background window:

Default ShortcutModification ShortcutAction
Ctrl+b MCtrl+Space MToggle monitor activity on current window
Ctrl+b !Ctrl+Space !Open command prompt for silence monitoring
:monitor-silence 30

Window List in the Status Bar

The status bar shows all windows:

[work] 0:editor* 1:server- 2:git "server01" 04:10
│ │ │ │ │
Session # Name # Name *=active, -=last used

Common Workflow: Dev Setup

dev-windows-setup.sh
#!/bin/bash
SESSION="work"

# create session with first window
tmux new -s "$SESSION" -n "editor" -d

# add more windows
tmux new-window -t "$SESSION" -n "server"
tmux new-window -t "$SESSION" -n "git"
tmux new-window -t "$SESSION" -n "logs"

# send initial commands to each window
tmux send-keys -t "$SESSION:server" "cd /srv/myapp && npm run dev" Enter
tmux send-keys -t "$SESSION:logs" "tail -f /var/log/syslog" Enter

# attach — starting on the editor window
tmux select-window -t "$SESSION:editor"
tmux attach -t "$SESSION"

Common Pitfalls

PitfallSymptomFix
Not naming windowsHard to find the right oneUse Ctrl+b , immediately after creating
Closing session when only one window leftSession killedDetach instead: Ctrl+b d
Too many windowsCluttered status barGroup related tasks per session instead

What's Next