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
Steps to rename a tmux window:
- List the windows in the target session so the current window index and name are visible before you rename 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.
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.
- 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.
Related: How to customize the tmux status bar
- Check the window rename behavior if a manual label changes back unexpectedly.
$ 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.
Notes
- The default rename prompt inside an attached client is bound to Prefix + , in current tmux, and the prompt starts with the current window name so only the changed text needs to be typed.
- rename-window changes only the window label; it does not kill the window, restart the shell, or rearrange panes inside the window.
- Window targets accept a session plus window index or name, but an index such as work:0 is usually the safest target for rename operations because the window name itself is the field being changed.
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.
