How do I rename a session in tmux?

From within tmux

Short way: prefix, then dollar sign:

Ctrl + B, $

or

Long way: prefix, then colon:

Ctrl + B, :

Then type this command at the prompt:

rename-session [-t current-name] [new-name]

If the current session name (-t current-name) is not specified, the currently attached session will be renamed.

By default the session name will be in brackets in the lower left corner of tmux. You can list all sessions and switch between them with:

Ctrl + B, s

From shell prompt

You can rename tmux sessions with

tmux rename-session [-t current-name] [new-name]

To find your session names, do tmux list-sessions -- it will be in the left-most column.

If the current session name (-t current-name) is not specified, the most recently used session will be renamed.


From within tmux you can also edit the name of the current window (one of many within the session) with:

  • Prefix, then comma sign:

Ctrl + B, ,

(This does not rename the "session", but the window inside a session, which many users that land here are searching for)