Break a pane into a window
Move a pane into a new window with break-pane, or prefix then an exclamation mark, and bring it back with join-pane. The process in it keeps running.
A pane that you want to keep running is taking up room, and it should move to a window of its own.
tmux kill-server 2>/dev/null; sleep 1
tmux new-session -d -s w -x 120 -y 30
tmux split-window -t w
tmux list-windows -t w -F 'window #{window_index}: #{window_name}, #{window_panes} pane(s)'
echo ---
tmux break-pane -d -s w:0.1 -n logs
tmux list-windows -t w -F 'window #{window_index}: #{window_name}, #{window_panes} pane(s)'
echo ---
tmux join-pane -s w:logs -t w:0
tmux list-windows -t w -F 'window #{window_index}: #{window_name}, #{window_panes} pane(s)'
tmux kill-serverwindow 0: bash, 2 pane(s)
---
window 0: bash, 1 pane(s)
window 1: logs, 1 pane(s)
---
window 0: bash, 2 pane(s)break-pane takes a pane out of its window and gives it a window of its own, and -n names that window. The shell or program inside is not touched, so a build or a tail keeps going. join-pane does the reverse, moving a pane into another window as a split, which the last listing shows with the second window gone. Both are in the tmux manual. Without -d the new window is selected at once.
A window with a single pane cannot be broken further, and the command fails. Window numbers can shift if renumber-windows is on. Tmux has no undo, so remember the name you gave the window before joining it back. The output is from tmux 3.3a.