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 status-interval 5 refreshes the tmux status bar more often

Tmux
~/tips/tip-tmux-status-interval

set -g status-interval 5

Sets how often tmux redraws its status line and refreshes the commands in it.

A status bar with a load average or a git branch in it is only as current as its last redraw. tmux has a default for that, and one option changes it.

tmux updates the status line every 15 seconds by default. The session option status-interval sets another number of seconds.

set -g status-interval 5

A value of 0 disables redrawing at an interval. Put a shell command in the status line with #(...) and the output follows that rhythm:

set -g status-right "#(uptime | cut -d, -f3-) %H:%M"

Reload the config with tmux source-file ~/.tmux.conf, then check the value:

tmux show -gv status-interval

Shell commands in #() are handled in a particular way. The manual says tmux does not wait for them. It shows the previous result of the same command, or a placeholder if the command has not run yet. If a command has not exited, tmux uses its most recent line of output, and the status line is not updated more than once a second.

So a command that takes ten seconds will always lag behind, however low the interval. Keep the commands in your status line quick, and let a slow one cache its own result in a file that the status line reads.

Further reading: tmux manual

Going deeper: Guide: advanced tmux, a config that grows with you, formats, layouts and more

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