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 pane-border-status top puts a label on every tmux pane

Tmux
~/tips/tip-tmux-pane-border-status

set -g pane-border-status top

Shows a label with a title or the running command in the border of every tmux pane.

Four tmux panes that all end in a shell prompt look the same to me, and that is exactly when a restart command lands in the wrong one. tmux can print a small label in the border of each pane, so you can see which pane is which before you type.

Put this line in ~/.tmux.conf and reload the config:

set -g pane-border-status top

Every pane now has a status line in its top border. Use bottom if you would rather have it there, and off takes it away again. Out of the box the label shows the pane number and the pane title in quotes. To give the pane you are in a name, run this inside it, or type it after Ctrl-b : without the word tmux:

tmux select-pane -T logs

A setup where I’d want this: a pane following docker logs -f on the Unraid server next to a pane where you edit the compose file. With “logs” and “edit” in the borders you never have to guess which pane gets the Ctrl-c.

The catch is that programs in a pane can set the title themselves with a terminal escape sequence. Plenty of shell prompts do that after every command, so your nice label is replaced by whatever the prompt sends a second later. Newer tmux versions have allow-set-title off to block that. My advice is to skip the fight and let the border show the running command, which tmux reads from the process and no prompt can overwrite:

set -g pane-border-format " #{pane_index}: #{pane_current_command} "

Then a pane running htop says htop, and a pane that is back at the prompt shows your shell’s name.

Further reading: tmux manual page

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