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: automatic-rename-format names tmux windows after their folder

Tmux
~/tips/tip-tmux-rename-format-folder

setw -g automatic-rename-format '#{b:pane_current_path}'

Shows the current folder instead of the program in window names.

By default tmux names a window after the program running in it, so you get five windows called zsh. Naming them after the folder tells you a lot more, I think.

setw -g automatic-rename-format '#{b:pane_current_path}'

pane_current_path is the folder of the active pane, and the b: modifier keeps only the last part of it, the basename. A window in ~/projects/blog is now called blog.

You can mix both if you like:

setw -g automatic-rename-format '#{b:pane_current_path}:#{pane_current_command}'

That gives names like blog:vim. This only works while automatic-rename is on, which it is by default. A window you renamed by hand with Ctrl-b , keeps its name, because renaming switches automatic naming off for that window.

tmux updates the names on its own timer, so after a cd it can take a second before the status bar catches up.

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