How do I rename a session in tmux?












278















When I first started using tmux, I didn't give my first session a name. Then, as I started creating different sessions for different tasks (work, play, etc), I started naming my sessions.



Now I have a bunch of different sessions, but the first one doesn't have a name. How can I name (or rename) it, both from within tmux and from a shell prompt?










share|improve this question





























    278















    When I first started using tmux, I didn't give my first session a name. Then, as I started creating different sessions for different tasks (work, play, etc), I started naming my sessions.



    Now I have a bunch of different sessions, but the first one doesn't have a name. How can I name (or rename) it, both from within tmux and from a shell prompt?










    share|improve this question



























      278












      278








      278


      74






      When I first started using tmux, I didn't give my first session a name. Then, as I started creating different sessions for different tasks (work, play, etc), I started naming my sessions.



      Now I have a bunch of different sessions, but the first one doesn't have a name. How can I name (or rename) it, both from within tmux and from a shell prompt?










      share|improve this question
















      When I first started using tmux, I didn't give my first session a name. Then, as I started creating different sessions for different tasks (work, play, etc), I started naming my sessions.



      Now I have a bunch of different sessions, but the first one doesn't have a name. How can I name (or rename) it, both from within tmux and from a shell prompt?







      tmux rename






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 22 '16 at 15:44









      Mateusz Piotrowski

      1,71121338




      1,71121338










      asked May 23 '12 at 17:15









      Richard JonesRichard Jones

      1,88321314




      1,88321314






















          2 Answers
          2






          active

          oldest

          votes


















          416














          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.






          share|improve this answer





















          • 1





            I'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
            May 23 '12 at 17:35








          • 2





            Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

            – skrblr
            May 23 '12 at 18:15








          • 1





            It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

            – random
            May 23 '12 at 18:54






          • 7





            Note that rename-session [new-name] is enough if you want to rename current session within tmux.

            – Matvey Aksenov
            Nov 7 '12 at 19:13






          • 4





            tmux new -s myname to start a new named session. so you don't run into this predicament next time.

            – Danny
            Nov 29 '14 at 18:34





















          9














          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)






          share|improve this answer


























          • I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

            – bonh
            Feb 14 '18 at 19:28






          • 1





            @bonh : set -g allow-rename off

            – samson
            Apr 26 '18 at 15:49













          • or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

            – spinup
            Oct 25 '18 at 16:00











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f428016%2fhow-do-i-rename-a-session-in-tmux%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          416














          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.






          share|improve this answer





















          • 1





            I'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
            May 23 '12 at 17:35








          • 2





            Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

            – skrblr
            May 23 '12 at 18:15








          • 1





            It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

            – random
            May 23 '12 at 18:54






          • 7





            Note that rename-session [new-name] is enough if you want to rename current session within tmux.

            – Matvey Aksenov
            Nov 7 '12 at 19:13






          • 4





            tmux new -s myname to start a new named session. so you don't run into this predicament next time.

            – Danny
            Nov 29 '14 at 18:34


















          416














          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.






          share|improve this answer





















          • 1





            I'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
            May 23 '12 at 17:35








          • 2





            Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

            – skrblr
            May 23 '12 at 18:15








          • 1





            It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

            – random
            May 23 '12 at 18:54






          • 7





            Note that rename-session [new-name] is enough if you want to rename current session within tmux.

            – Matvey Aksenov
            Nov 7 '12 at 19:13






          • 4





            tmux new -s myname to start a new named session. so you don't run into this predicament next time.

            – Danny
            Nov 29 '14 at 18:34
















          416












          416








          416







          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.






          share|improve this answer















          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.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Dec 17 '14 at 10:00









          David Oliver

          1107




          1107










          answered May 23 '12 at 17:28









          skrblrskrblr

          4,321195




          4,321195








          • 1





            I'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
            May 23 '12 at 17:35








          • 2





            Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

            – skrblr
            May 23 '12 at 18:15








          • 1





            It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

            – random
            May 23 '12 at 18:54






          • 7





            Note that rename-session [new-name] is enough if you want to rename current session within tmux.

            – Matvey Aksenov
            Nov 7 '12 at 19:13






          • 4





            tmux new -s myname to start a new named session. so you don't run into this predicament next time.

            – Danny
            Nov 29 '14 at 18:34
















          • 1





            I'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
            May 23 '12 at 17:35








          • 2





            Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

            – skrblr
            May 23 '12 at 18:15








          • 1





            It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

            – random
            May 23 '12 at 18:54






          • 7





            Note that rename-session [new-name] is enough if you want to rename current session within tmux.

            – Matvey Aksenov
            Nov 7 '12 at 19:13






          • 4





            tmux new -s myname to start a new named session. so you don't run into this predicament next time.

            – Danny
            Nov 29 '14 at 18:34










          1




          1





          I'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
          May 23 '12 at 17:35







          I'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
          May 23 '12 at 17:35






          2




          2





          Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

          – skrblr
          May 23 '12 at 18:15







          Hmm.. 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 with tmux list-sessions, it'll be the left-most item. Will probably be '0' if it was the first session you created. Then tmux rename-session -t 0 renamed_session. Both commands should work from within tmux.

          – skrblr
          May 23 '12 at 18:15






          1




          1





          It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

          – random
          May 23 '12 at 18:54





          It'd be better if you flesh out your answer with a comprehensive edit instead of back and forth comments

          – random
          May 23 '12 at 18:54




          7




          7





          Note that rename-session [new-name] is enough if you want to rename current session within tmux.

          – Matvey Aksenov
          Nov 7 '12 at 19:13





          Note that rename-session [new-name] is enough if you want to rename current session within tmux.

          – Matvey Aksenov
          Nov 7 '12 at 19:13




          4




          4





          tmux new -s myname to start a new named session. so you don't run into this predicament next time.

          – Danny
          Nov 29 '14 at 18:34







          tmux new -s myname to start a new named session. so you don't run into this predicament next time.

          – Danny
          Nov 29 '14 at 18:34















          9














          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)






          share|improve this answer


























          • I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

            – bonh
            Feb 14 '18 at 19:28






          • 1





            @bonh : set -g allow-rename off

            – samson
            Apr 26 '18 at 15:49













          • or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

            – spinup
            Oct 25 '18 at 16:00
















          9














          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)






          share|improve this answer


























          • I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

            – bonh
            Feb 14 '18 at 19:28






          • 1





            @bonh : set -g allow-rename off

            – samson
            Apr 26 '18 at 15:49













          • or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

            – spinup
            Oct 25 '18 at 16:00














          9












          9








          9







          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)






          share|improve this answer















          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)







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 24 at 21:51

























          answered Jun 21 '16 at 11:08









          rubo77rubo77

          1,73272857




          1,73272857













          • I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

            – bonh
            Feb 14 '18 at 19:28






          • 1





            @bonh : set -g allow-rename off

            – samson
            Apr 26 '18 at 15:49













          • or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

            – spinup
            Oct 25 '18 at 16:00



















          • I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

            – bonh
            Feb 14 '18 at 19:28






          • 1





            @bonh : set -g allow-rename off

            – samson
            Apr 26 '18 at 15:49













          • or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

            – spinup
            Oct 25 '18 at 16:00

















          I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

          – bonh
          Feb 14 '18 at 19:28





          I've noticed that if I do this while a program is running, the current window loses its name when the program finishes. Is there any way around that?

          – bonh
          Feb 14 '18 at 19:28




          1




          1





          @bonh : set -g allow-rename off

          – samson
          Apr 26 '18 at 15:49







          @bonh : set -g allow-rename off

          – samson
          Apr 26 '18 at 15:49















          or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

          – spinup
          Oct 25 '18 at 16:00





          or if you have trouble remembering the comma, you can use rename-window from the command prompt (prefix, :)

          – spinup
          Oct 25 '18 at 16:00


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f428016%2fhow-do-i-rename-a-session-in-tmux%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Plaza Victoria

          In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

          How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...