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: tmux find-window searches window names and visible text for a word

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

tmux find-window 'Permission denied'

Finds the tmux window whose name, title or visible text matches a pattern.

With a dozen windows open, I lose track of the one that had the error message on screen. Cycling through them one by one is a slow way to look for it.

find-window does the searching. The default key is Ctrl-b f, which prompts for text to search for in open windows, and it works as a command too:

tmux find-window 'Permission denied'

From the manual: it searches for a glob pattern, or with -r a regular expression, in window names, titles and visible content, but not in the history. Flags narrow it down. -N matches only the window name, -T only the title, -C only the visible content, and -i ignores case. The default is -CNT.

tmux then shows the matching windows as a list to pick from, and you jump to the one you choose.

A quick example with a name search. If you called a window deploy, this finds it without caring about case:

tmux find-window -iN deploy

An unanchored word is enough for the default key. The glob form means * works too, so Permission* matches more than the exact sentence.

The caveat is the one in the manual: history is not searched. If the text has already scrolled off the screen, that window will not show up. The command also works only if at least one client is attached, so it does nothing in a script that runs with no client.

Further reading: tmux manual (find-window)

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