Interactive search of tmux sessions












4















When switching between tmux sessions with the interactive session menu (<prefix>-s), you can jump to a specific session by typing the session's numeric or alphabetical index, e.g.



(0) + first_session: 1 windows
(1) + second_session: 2 windows
(2) + third_session: 1 windows
(3) + secret_session: 1 windows



Pressing 1 will open up the second_session session.



I often have >20 tmux sessions open and I'd like to have a way to search without looking at the whole list. Is there a way to change the behaviour to have an interactive search? That is, I would like to type sec and have the list narrow to



(1) + second_session: 2 windows
(3) + secret_session: 1 windows



I've googled quite a bit and found nothing; is this behaviour possible?










share|improve this question





























    4















    When switching between tmux sessions with the interactive session menu (<prefix>-s), you can jump to a specific session by typing the session's numeric or alphabetical index, e.g.



    (0) + first_session: 1 windows
    (1) + second_session: 2 windows
    (2) + third_session: 1 windows
    (3) + secret_session: 1 windows



    Pressing 1 will open up the second_session session.



    I often have >20 tmux sessions open and I'd like to have a way to search without looking at the whole list. Is there a way to change the behaviour to have an interactive search? That is, I would like to type sec and have the list narrow to



    (1) + second_session: 2 windows
    (3) + secret_session: 1 windows



    I've googled quite a bit and found nothing; is this behaviour possible?










    share|improve this question



























      4












      4








      4


      1






      When switching between tmux sessions with the interactive session menu (<prefix>-s), you can jump to a specific session by typing the session's numeric or alphabetical index, e.g.



      (0) + first_session: 1 windows
      (1) + second_session: 2 windows
      (2) + third_session: 1 windows
      (3) + secret_session: 1 windows



      Pressing 1 will open up the second_session session.



      I often have >20 tmux sessions open and I'd like to have a way to search without looking at the whole list. Is there a way to change the behaviour to have an interactive search? That is, I would like to type sec and have the list narrow to



      (1) + second_session: 2 windows
      (3) + secret_session: 1 windows



      I've googled quite a bit and found nothing; is this behaviour possible?










      share|improve this question
















      When switching between tmux sessions with the interactive session menu (<prefix>-s), you can jump to a specific session by typing the session's numeric or alphabetical index, e.g.



      (0) + first_session: 1 windows
      (1) + second_session: 2 windows
      (2) + third_session: 1 windows
      (3) + secret_session: 1 windows



      Pressing 1 will open up the second_session session.



      I often have >20 tmux sessions open and I'd like to have a way to search without looking at the whole list. Is there a way to change the behaviour to have an interactive search? That is, I would like to type sec and have the list narrow to



      (1) + second_session: 2 windows
      (3) + secret_session: 1 windows



      I've googled quite a bit and found nothing; is this behaviour possible?







      linux command-line tmux bsd command-line-tool






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 20 '15 at 17:44









      Nifle

      28.1k2395129




      28.1k2395129










      asked Mar 20 '15 at 13:56









      GarySGaryS

      1232




      1232






















          2 Answers
          2






          active

          oldest

          votes


















          6














          Yes it is, but as far as i know you'll need an extra tool for the searching itself.
          I'm using fzf for the (fuzzy) searching. Once fzf is installed you can use the following config to set up the session switching with search:



          bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v "^$(tmux display-message -p '#S')$" | fzf --reverse | xargs tmux switch-client -t"


          I didn't figure this out myself but took this from Chris Toomey's public tmux conf.






          share|improve this answer


























          • This is freaking amazing!

            – Trevor Hartman
            Mar 27 '17 at 16:41











          • please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

            – abbood
            Jul 5 '18 at 7:50



















          -1














          @bartj3: Thanks. This is super cool!



          Here is a slightly enhanced version (w/o sed and grep) for both switching sessions and windows:



          bind j split-window -v "tmux list-sessions -F '#S' | fzf --reverse | xargs tmux switch-client -t"
          bind k split-window -v "tmux list-window -F '#W' | fzf --reverse | xargs tmux select-window -t"


          PROBLEM:



          If you use the above while synchronize-panes is on, your search key-strokes will also type in the other panes.



          QUESTION:



          Does anyone have an idea on how to limit the key-strokes to the search-pane?






          share|improve this answer
























          • While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

            – Ramhound
            Jan 22 at 21:49











          • Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

            – Rey Juna
            Jan 22 at 23:04











          • Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

            – s3_
            Jan 22 at 23:20













          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%2f891915%2finteractive-search-of-tmux-sessions%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









          6














          Yes it is, but as far as i know you'll need an extra tool for the searching itself.
          I'm using fzf for the (fuzzy) searching. Once fzf is installed you can use the following config to set up the session switching with search:



          bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v "^$(tmux display-message -p '#S')$" | fzf --reverse | xargs tmux switch-client -t"


          I didn't figure this out myself but took this from Chris Toomey's public tmux conf.






          share|improve this answer


























          • This is freaking amazing!

            – Trevor Hartman
            Mar 27 '17 at 16:41











          • please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

            – abbood
            Jul 5 '18 at 7:50
















          6














          Yes it is, but as far as i know you'll need an extra tool for the searching itself.
          I'm using fzf for the (fuzzy) searching. Once fzf is installed you can use the following config to set up the session switching with search:



          bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v "^$(tmux display-message -p '#S')$" | fzf --reverse | xargs tmux switch-client -t"


          I didn't figure this out myself but took this from Chris Toomey's public tmux conf.






          share|improve this answer


























          • This is freaking amazing!

            – Trevor Hartman
            Mar 27 '17 at 16:41











          • please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

            – abbood
            Jul 5 '18 at 7:50














          6












          6








          6







          Yes it is, but as far as i know you'll need an extra tool for the searching itself.
          I'm using fzf for the (fuzzy) searching. Once fzf is installed you can use the following config to set up the session switching with search:



          bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v "^$(tmux display-message -p '#S')$" | fzf --reverse | xargs tmux switch-client -t"


          I didn't figure this out myself but took this from Chris Toomey's public tmux conf.






          share|improve this answer















          Yes it is, but as far as i know you'll need an extra tool for the searching itself.
          I'm using fzf for the (fuzzy) searching. Once fzf is installed you can use the following config to set up the session switching with search:



          bind C-j split-window -v "tmux list-sessions | sed -E 's/:.*$//' | grep -v "^$(tmux display-message -p '#S')$" | fzf --reverse | xargs tmux switch-client -t"


          I didn't figure this out myself but took this from Chris Toomey's public tmux conf.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 25 '17 at 6:18

























          answered Mar 25 '15 at 11:50









          bartj3bartj3

          764




          764













          • This is freaking amazing!

            – Trevor Hartman
            Mar 27 '17 at 16:41











          • please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

            – abbood
            Jul 5 '18 at 7:50



















          • This is freaking amazing!

            – Trevor Hartman
            Mar 27 '17 at 16:41











          • please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

            – abbood
            Jul 5 '18 at 7:50

















          This is freaking amazing!

          – Trevor Hartman
          Mar 27 '17 at 16:41





          This is freaking amazing!

          – Trevor Hartman
          Mar 27 '17 at 16:41













          please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

          – abbood
          Jul 5 '18 at 7:50





          please pardon my tmux nubeness.. but I'm not sure what to type to reach that point? this is what i have in my tmux.conf file: set-option -g prefix C-a .. the above shortuct (ie bind C-j split-window.. so what do i type from a terminal to see this quick search thing?

          – abbood
          Jul 5 '18 at 7:50













          -1














          @bartj3: Thanks. This is super cool!



          Here is a slightly enhanced version (w/o sed and grep) for both switching sessions and windows:



          bind j split-window -v "tmux list-sessions -F '#S' | fzf --reverse | xargs tmux switch-client -t"
          bind k split-window -v "tmux list-window -F '#W' | fzf --reverse | xargs tmux select-window -t"


          PROBLEM:



          If you use the above while synchronize-panes is on, your search key-strokes will also type in the other panes.



          QUESTION:



          Does anyone have an idea on how to limit the key-strokes to the search-pane?






          share|improve this answer
























          • While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

            – Ramhound
            Jan 22 at 21:49











          • Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

            – Rey Juna
            Jan 22 at 23:04











          • Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

            – s3_
            Jan 22 at 23:20


















          -1














          @bartj3: Thanks. This is super cool!



          Here is a slightly enhanced version (w/o sed and grep) for both switching sessions and windows:



          bind j split-window -v "tmux list-sessions -F '#S' | fzf --reverse | xargs tmux switch-client -t"
          bind k split-window -v "tmux list-window -F '#W' | fzf --reverse | xargs tmux select-window -t"


          PROBLEM:



          If you use the above while synchronize-panes is on, your search key-strokes will also type in the other panes.



          QUESTION:



          Does anyone have an idea on how to limit the key-strokes to the search-pane?






          share|improve this answer
























          • While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

            – Ramhound
            Jan 22 at 21:49











          • Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

            – Rey Juna
            Jan 22 at 23:04











          • Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

            – s3_
            Jan 22 at 23:20
















          -1












          -1








          -1







          @bartj3: Thanks. This is super cool!



          Here is a slightly enhanced version (w/o sed and grep) for both switching sessions and windows:



          bind j split-window -v "tmux list-sessions -F '#S' | fzf --reverse | xargs tmux switch-client -t"
          bind k split-window -v "tmux list-window -F '#W' | fzf --reverse | xargs tmux select-window -t"


          PROBLEM:



          If you use the above while synchronize-panes is on, your search key-strokes will also type in the other panes.



          QUESTION:



          Does anyone have an idea on how to limit the key-strokes to the search-pane?






          share|improve this answer













          @bartj3: Thanks. This is super cool!



          Here is a slightly enhanced version (w/o sed and grep) for both switching sessions and windows:



          bind j split-window -v "tmux list-sessions -F '#S' | fzf --reverse | xargs tmux switch-client -t"
          bind k split-window -v "tmux list-window -F '#W' | fzf --reverse | xargs tmux select-window -t"


          PROBLEM:



          If you use the above while synchronize-panes is on, your search key-strokes will also type in the other panes.



          QUESTION:



          Does anyone have an idea on how to limit the key-strokes to the search-pane?







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 22 at 21:27









          s3_s3_

          31




          31













          • While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

            – Ramhound
            Jan 22 at 21:49











          • Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

            – Rey Juna
            Jan 22 at 23:04











          • Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

            – s3_
            Jan 22 at 23:20





















          • While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

            – Ramhound
            Jan 22 at 21:49











          • Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

            – Rey Juna
            Jan 22 at 23:04











          • Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

            – s3_
            Jan 22 at 23:20



















          While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

          – Ramhound
          Jan 22 at 21:49





          While this answer actually does appear to answer the question. The fact you submitted your own question, within the answer body, makes it impossible to answers your question.

          – Ramhound
          Jan 22 at 21:49













          Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

          – Rey Juna
          Jan 22 at 23:04





          Welcome to SuperUser! Your answer includes another question. Your question will get the appropriate attention if you post it as a new question. Please review site guidelines on How to Ask and How to Answer. Also, you will find that you will have a better experience if you take moment to take the Stack Overflow tour. If you follow the norms of the Stack Overflow community and approach it with an attitude of helping others too, it will serve you well.

          – Rey Juna
          Jan 22 at 23:04













          Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

          – s3_
          Jan 22 at 23:20







          Ok. Posted as a new question in superuser.com/questions/1397211. Thanks.

          – s3_
          Jan 22 at 23:20




















          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%2f891915%2finteractive-search-of-tmux-sessions%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...