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 . moves a tmux window to another number or session

Tmux
~/tips/tip-tmux-move-window-prompt

Ctrl-b .

Moves the current window to a new index or another session.

Window order in tmux is just the index numbers. To put a window somewhere else, or hand it over to another session, there is a prompt for that.

Ctrl-b .

tmux asks for a target and runs move-window with it. Type a free number like 5 and the current window becomes window 5. Type a session name with a colon, like work:, and the window leaves this session and lands in work at the first free index.

The same works from a shell, which is nice in scripts:

tmux move-window -s home:logs -t work:

That takes the window called logs from the home session and moves it into work. The programs in it keep running; only its place changes.

Moving to a number that is already taken fails with an error. Either choose a free one, or use swap-window to trade places instead. If you want the window in both sessions at once rather than moved, that is link-window.

I find it most useful for tidying up after a busy day, when a log window ended up in the wrong project session.

Further reading: tmux manual page (OpenBSD)

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