Renaming a tmux session changes the name used in session lists, status lines, and target selectors, which is useful when a temporary workspace name no longer matches the job running inside it or when several sessions need clearer labels.

The rename-session command updates the session name without restarting the shell, windows, or panes already running in that session. Later tmux commands such as attach-session, switch-client, and list-sessions immediately show the new name, so it is safest to rename the session before other users or scripts try to target it.

Session names must stay unique on the same tmux server. Current tmux also treats the -t session target as an exact name first, then a prefix or pattern match if needed, so the clearest workflow is to list the sessions first, rename the exact target, and confirm that the new name now appears in the session list.

Steps to rename a tmux session:

  1. List the current tmux sessions so the old name is visible before you rename anything.
    $ tmux list-sessions
    build: 1 windows (created Wed Apr 15 14:38:26 2026)
    ops: 1 windows (created Wed Apr 15 14:38:28 2026)

    Use the name at the start of the line as the -t target in the next command.

  2. Rename the target session to the new label.
    $ tmux rename-session -t build app

    The last argument is the replacement session name, so this command changes build to app immediately.

  3. Verify that tmux now lists the session under the new name.
    $ tmux list-sessions
    app: 1 windows (created Wed Apr 15 14:38:26 2026)
    ops: 1 windows (created Wed Apr 15 14:38:28 2026)

    Any later attach-session -t app or switch-client -t app command must use the new name rather than the old one.

  4. Use an exact-match target when several session names share a similar prefix.
    $ tmux rename-session -t =app project-prod

    Prefixing the target with = tells current tmux to match only the exact session name instead of falling back to a prefix or pattern match.

  5. Choose a different replacement name if tmux reports that the requested name already exists.
    $ tmux rename-session -t project-prod ops
    duplicate session: ops

    Session names must be unique on the same tmux server, so reuse a different name instead of trying to overwrite another running session.

Notes

  • Inside an attached tmux client, the default Prefix + $ binding opens a rename prompt for the current session and fills it with the existing session name.
  • Renaming a session changes only the session identifier; it does not stop the session, close any windows, or change the names of windows and panes inside it.
  • If you use more than one tmux server socket with -L or -S, rename the session on the same server that owns the target session.