brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: Ctrl-b & closes a whole tmux window after one confirmation

Tmux
~/tips/tip-tmux-kill-window

Ctrl-b &

Closes the current tmux window and every pane in it, but asks first.

Closing a window pane by pane is slow. One shortcut ends the whole window.

Ctrl-b &

tmux asks kill-window X? (y/n) in the status bar. Press y and the window disappears together with everything running in it. Any other key cancels. The confirmation is the safety net, because every program in that window is stopped.

If you only want to get rid of one pane, use Ctrl-b x instead. It asks the same question for just the pane you are in.

From the command line the equivalent is tmux kill-window -t 3. That version does not ask anything, so check the window number first with tmux list-windows.

Try it without risk: start a throwaway session with tmux new -s scratch, use the shortcut or command above there, look at what changes, and close it again with tmux kill-session -t scratch. Nothing else on your machine is touched.

Further reading: tmux manual page (OpenBSD, official), tmux wiki: Getting Started (official)

More Tmux tips tmux new -d -s report -x 200 -y 50 'top' tmux wait-for build-done set -g allow-passthrough on tmux kill-server Ctrl-b [ All Tmux tips (125) All topics

Link