Busy tmux sessions become hard to navigate when every window keeps a shell-derived name such as zsh, bash, or editor. A manual window label puts the job name in the status bar and window list, which reduces wrong-window jumps when switching by number or targeting windows from later tmux commands.
The rename-window command changes the tmux window name without restarting the shell or changing pane contents. In an attached client, the default Ctrl+b then comma binding opens the same rename prompt for the current window, while the shell command form is clearer for scripts and for renaming a specific session:window target.
Targets can match a window by index, ID, or name, so list the windows before renaming and use the index when the existing name is about to change. A manual rename normally disables automatic renaming for that window, but explicit automatic-rename settings or terminal-driven rename sequences can still replace a label later, so verify the final list before using the new name in navigation or automation.
Related: How to create a window in tmux
Related: How to customize the tmux status bar
Steps to rename a tmux window:
- List the windows in the target session before renaming anything.
$ tmux list-windows -t work 0: shell* (1 panes) [80x24] [layout b25d,80x24,0,0,0] @0 (active)
The index at the start of the line is the most reliable target because it does not change when the window name changes.
- Rename the target window to the new label.
$ tmux rename-window -t work:0 editor
The last argument is the replacement name, so this command changes window 0 in session work from shell to editor immediately.
- Verify that the new name now appears in the window list.
$ tmux list-windows -t work 0: editor* (1 panes) [80x24] [layout b25d,80x24,0,0,0] @0 (active)
The asterisk marks the current window, and the new name is the label that now appears in the status bar and in later window targets.
- Check automatic renaming if a manual label changes back unexpectedly.
$ tmux show-options -w -t work:0 automatic-rename automatic-rename off
rename-window normally turns automatic-rename off for the renamed window. If this prints on, run tmux set-option -w -t work:0 automatic-rename off and rename the window again.
If a program inside the active pane still changes the label, disable the separate allow-rename option before relying on the name in scripts or status-line rules.
Mohd Shakir Zakaria is a cloud architect with deep roots in software development and open-source advocacy. Certified in AWS, Red Hat, VMware, ITIL, and Linux, he specializes in designing and managing robust cloud and on-premises infrastructures.