Update Terminal Window Title with tmux

Text selection with mouse in tmux Window title changed to UnixTutorial in my Alacritty/tmux session

I have been using tmux more often than usual over the past few months, and realised that my basic tmux configuration was lacking a rather important functionality: automatic update of the iTerm2 terminal window tile based on the tmux context I was in.

Windows Title Settings in tmux

As always, tmux has got your needs covered and probably has more options for the things you didn’t even think about yet! Amazingly powerful software, this tmux thing.

So for windows title management, I added the following:

set -g set-titles on
set -g set-titles-string "#W"

The first option instructs tmux to update terminal windows title (you need to also enable dynamic title updates in your iTerm2, Alacritty or Gnome Terminal).

The second one specifies format - I just want to know the name of my tmux window (tab names at the bottom of the screen). But it’s also possible to update it to include the current tmux pane name as well - I’m not enabling it yet but it would be configured like this:

set -g set-titles-string "#W/#T"

Now whenever I’m switching between windows in tmux, this updates the title of the window - meaning I can see it easily when switching tasks in macOS.

See Also

Keep Learning with Me

Follow me on Facebook and Twitter or jump into Telegram chat!:
Recommended Software
I use Brave browser, it's awesome: Brave Browser I'm also a fan of SetApp for macOS: SetApp for macOS
IT Consultancy
I'm a principal consultant with Tech Stack Solutions. I help with cloud architectrure, AWS deployments and automated management of Unix/Linux infrastructure. Get in touch!
Recent Articles
18 Jun 2021

CentOS 8.4 Released

17 Jun 2021

yum/dnf Package Manager Basics

07 Jun 2021


Recent Tweets