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.
8
tmux new -s myname
to start a new named session. so you don't run into this predicament next time. – Danny – 2014-11-29T18:34:40.073if you get at
rename-session
a "command not found" you forgot to press^B
+:
– rubo77 – 2016-06-21T11:06:33.2671I'm trying to create a canonical answer. Can you also tell me how to do this from within tmux? And also how I would find out what my session is currently named? – Richard Jones – 2012-05-23T17:35:41.943
The default key binding for
rename-session
isCtrl-b $
. Actually, it usescommand-prompt
to 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 – 2012-05-23T17:44:01.8772Hmm..
C-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 – 2012-05-23T18:15:11.6771It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments – random – 2012-05-23T18:54:51.890
8Note that
rename-session [new-name]
is enough if you want to rename current session within tmux. – Matvey Aksenov – 2012-11-07T19:13:52.607