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.
rename-sessionisCtrl-b $. Actually, it usescommand-promptto provide a minimal interface torename-session. The prompt uses the current session name as the default value, which you can delete and replace with the new name. If you haven't changed your status bar from the default, the session name should be displayed on the left-hand side. – chepner May 23 '12 at 17:44C-b $doesn't seem to be set by default in my tmux on Ubuntu 10.04. At any rate, you can find the name of your current session withtmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Thentmux rename-session -t 0 renamed_session. Both commands should work from within tmux. – skrblr May 23 '12 at 18:15rename-session [new-name]is enough if you want to rename current session within tmux. – Matvey Aksenov Nov 07 '12 at 19:13tmux new -s mynameto start a new named session. so you don't run into this predicament next time. – Danny Nov 29 '14 at 18:34rename-sessiona "command not found" you forgot to press^B+:– rubo77 Jun 21 '16 at 11:06rename(an alias) instead ofrename-session. – rrd Jan 30 '23 at 18:31