Renaming a tmux window changes the label shown in the status bar and window list, which makes it easier to tell shells, editors, logs, and one-off tasks apart in a busy session. Clear window names reduce mistakes when switching by number, reading activity flags, or targeting windows from later tmux commands.
Current tmux changes a window name with the rename-window command, and the new label appears immediately anywhere tmux prints the window list. In an attached client, the default Prefix + , binding opens a rename prompt with the current window name prefilled, while the shell command form is better for scripts and for renaming a specific window from outside the session.
Manual names do not restart the shell or change pane contents, but they can be replaced later if that window uses automatic-rename or if a program inside the pane is allowed to rename the window with terminal escape sequences. The safest flow is to list the current windows, rename the exact target, and verify that the new label is still present before relying on it in navigation or automation.
Related: How to create a window in tmux
Related: How to customize the tmux status bar
$ 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.
$ 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.
If the client is already attached to that window, the default Prefix + , shortcut opens the same rename workflow in the status prompt with the current name prefilled.
$ 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.
Related: How to customize the tmux status bar
$ tmux show-options -w -t work:0 automatic-rename automatic-rename off
If this prints on, run tmux set-option -w -t work:0 automatic-rename off and rename the window again so the active command does not replace the custom label.
Programs inside the active pane can also replace a custom label later when the window allows terminal-driven renames, so recheck the live name before using it in scripts or status-line rules.