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: set -g set-titles on makes your terminal tab show the tmux session

Tmux
~/tips/tip-tmux-set-titles

set -g set-titles on

Makes the terminal tab or window title show the tmux session and window name.

With several terminal tabs open, they all read the same. Mine would show the host name and nothing else, which says little about which tab holds which tmux session.

tmux can set the title of the terminal itself. The manual says this is off by default:

set -g set-titles on
set -g set-titles-string '#S: #W'

According to the manual, set-titles attempts to set the client terminal title using the terminfo entries tsl and fsl if they exist, and tmux sets these automatically to the \e]0;...\007 sequence if the terminal appears to be xterm. The set-titles-string option holds the text, and formats are expanded, so #S is the session name and #W the window name.

After a reload, a tab shows something like work: logs and follows you when you switch windows. If you also want the host in it, there is a format for that:

set -g set-titles-string '#{host} | #S: #W'

Here #{host} is the host name. That variant helps when you attach to tmux on several machines and the tabs would otherwise look alike.

The caveat is that the title only changes when the terminal accepts the title sequence. Some terminals or their profiles overwrite titles with their own, and then you need to turn that off on the terminal side. The option applies to the client’s terminal title only, so it does not rename any tmux window.

Further reading: tmux manual (set-titles)

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