Write all tmux scrollback to a file

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












167















How can I write all the scrollback in a tmux session to a file?



capture-panel can grab the current screen, but not the entire scrollback.










share|improve this question




























    167















    How can I write all the scrollback in a tmux session to a file?



    capture-panel can grab the current screen, but not the entire scrollback.










    share|improve this question


























      167












      167








      167


      63






      How can I write all the scrollback in a tmux session to a file?



      capture-panel can grab the current screen, but not the entire scrollback.










      share|improve this question
















      How can I write all the scrollback in a tmux session to a file?



      capture-panel can grab the current screen, but not the entire scrollback.







      tmux






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 9 '14 at 16:20







      David Wolever

















      asked Dec 10 '11 at 20:29









      David WoleverDavid Wolever

      1,30421214




      1,30421214




















          8 Answers
          8






          active

          oldest

          votes


















          49














          This depends on the value of history-limit that you have set in your .tmux.conf - the default is 2000; if you wish to capture more, you will need to explicitly set the number of lines.



          To capture the entire scrollback, enter copy mode, select the entire scrollback, and yank it into the buffer, then paste it into your file.



          How you accomplish this will depend on the mode-keys option you prefer, vi or emacs. man tmux has a helpful table describing the respective keys.



          I have the following in my .tmux.conf to simplify this:



          unbind [
          bind Escape copy-mode
          unbind p
          bind p paste-buffer
          bind-key -t vi-copy 'v' begin-selection
          bind-key -t vi-copy 'y' copy-selection



          The process for capturing the full scrollback is then:



          PrefixEsc : to enter copy mode



          v : to begin visual selection (assuming you are already at the bottom of the screen)



          gg : to capture everything in the scrollback



          y : to yank it into the buffer



          Prefixc : open another tmux window



          vim scrollback.txt


          i : enter insert mode in vim



          Prefixp : paste into file



          There is also an answer here describing how to copy the buffer to a temporary file using xsel that might be useful.






          share|improve this answer




















          • 2





            This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

            – Konrad Rudolph
            Jan 21 '15 at 16:19






          • 10





            If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

            – tlunter
            Feb 4 '15 at 21:18











          • @tlunter nice tip!

            – jasonwryan
            Feb 4 '15 at 23:10











          • Can this be done with default key bindings?

            – daveloyall
            Nov 5 '15 at 17:00











          • @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

            – jasonwryan
            Nov 5 '15 at 17:14


















          158














          For those looking for a simple answer, just use prefix + :, then type in capture-pane -S -3000 + return (Replace 3000 with however many lines you'd like to save.) This copies those lines into a buffer.



          Then, to save the buffer to a file, just use prefix + : again, and type in save-buffer filename.txt + return, replacing filename with whatever you'd like.



          (By default prefix is ctrl + b.)






          share|improve this answer




















          • 8





            save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

            – MohamedEzz
            Dec 8 '16 at 9:54






          • 10





            and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

            – Yordan Georgiev
            Dec 23 '16 at 12:46






          • 8





            This is the best answer here. Thank you so much.

            – Jesse Atkinson
            Apr 21 '17 at 21:22






          • 6





            Yes, you win. This should be the top answer.

            – wordsforthewise
            Jun 6 '17 at 19:39


















          148














          With tmux 1.5, the capture-pane command accepts -S and -E to specify the start and end lines of the capture; negative values can be used to specify lines from the history. Once you have the data in a buffer, you can save it with save-buffer.



          Here is an example binding (suitable for .tmux.conf) that wraps it all up with a prompt for the filename:



          bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'


          This captures (up to) 32768 lines of history plus the currently displayed lines. Starting with tmux 1.6, you can use numbers down to INT_MIN if your pane has a history that is deeper than 32Ki lines (usually up to 2Gi lines). Starting in tmux 2.0, you can use capture-pane -S - to mean “start at the beginning of history” (i.e. no large, hard-coded negative number).




          Note: The number of lines in the saved file will not always be equal to the pane’s history limit plus its height.



          When a pane’s history buffer is full, tmux discards the oldest 10% of the lines instead of discarding just one line. This means a pane’s effective history depth will sometimes be as low as 90% of its configured limit.






          share|improve this answer




















          • 1





            You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

            – Chris Johnsen
            Dec 12 '11 at 8:03






          • 1





            This is by far one of the most useful tmux commands I have found.

            – kenny
            Jul 19 '12 at 19:03






          • 1





            And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

            – Ali
            Dec 17 '13 at 21:43






          • 1





            @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

            – Aleksandr Dubinsky
            Jul 5 '17 at 21:07






          • 1





            @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

            – Aleksandr Dubinsky
            Jul 15 '17 at 5:24


















          18














          I had standard key bindings which appeared to be a bit different than in @jasonwryan's answer and didn't change anything in config.



          Below is recipe that worked for me. Maybe you will find it useful if you don't want to make any changes in tmux config and just want to quickly copy some of the scrollback.



          Prefix == Ctrl+b in my tmux (tmux 1.6, debian 7).



          1. Enter select mode: Prefix + [.

          2. Start selection: Space.

          3. Highlight necessary text using vim navigation (for instance, use arrow keys or press gg to reach beginning of output history).

          4. Actually copy in internal clipboard using Enter. You will be exited from copy mode.

          5. Open any file using vim (probably on new tmux tab) and paste content you copied before using Prefix + ].

          6. Then you may do cat of that file or use output how you need.





          share|improve this answer

























          • man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

            – Cognitiaclaeves
            Aug 4 '17 at 1:29


















          11














          Here's a tmux plugin that enables this:



          https://github.com/tmux-plugins/tmux-logging



          After you install it, save the entire scrollback with prefix + alt-shift-p.






          share|improve this answer






























            9














            If you want something you can run from the command line (instead of using your tmux prefix keys), try running:



            tmux capture-pane -pS -1000000


            If you run it and it seems to not do anything, that's because it's outputting exactly what was just on your screen, so it looks the same.



            Of course, you can also pipe it into a file:



            tmux capture-pane -pS -1000000 > file.out


            See the tmux man page and search for capture-pane for more things you can do (like capture escape sequences in case you want to preserve color, or specify whether you want multiple visual lines to be joined when they don't contain a new line)






            share|improve this answer























            • This is very helpful, especially since the accepted answer no longer works.

              – piojo
              Jan 16 at 7:22


















            2














            This is actually very easy.
            Enter the command mode by press prefix key then :.
            Then do capture-pane -S -<line number you want to dump>
            Then save-buffer <filepath>



            That file contains all the scrollback output. You should delete the buffer afterwards for safety reason.






            share|improve this answer






























              0















              How can I write all the scrollback in a tmux session to a file?




              I use this in my ~/.tmux.conf, and now when I exit my running shell, pane output is saved to unique log file:



              set -g remain-on-exit
              set-hook pane-died 'capture-pane -S - -E - ; save-buffer "$HOME/logs/tmux/tmux-saved.#host_short-#session_id:#window_id:#pane_id-#pane_pid-#client_activity.log"; delete-buffer; kill-pane'





              share|improve this answer






















                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "106"
                ;
                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: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                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%2funix.stackexchange.com%2fquestions%2f26548%2fwrite-all-tmux-scrollback-to-a-file%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                8 Answers
                8






                active

                oldest

                votes








                8 Answers
                8






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                49














                This depends on the value of history-limit that you have set in your .tmux.conf - the default is 2000; if you wish to capture more, you will need to explicitly set the number of lines.



                To capture the entire scrollback, enter copy mode, select the entire scrollback, and yank it into the buffer, then paste it into your file.



                How you accomplish this will depend on the mode-keys option you prefer, vi or emacs. man tmux has a helpful table describing the respective keys.



                I have the following in my .tmux.conf to simplify this:



                unbind [
                bind Escape copy-mode
                unbind p
                bind p paste-buffer
                bind-key -t vi-copy 'v' begin-selection
                bind-key -t vi-copy 'y' copy-selection



                The process for capturing the full scrollback is then:



                PrefixEsc : to enter copy mode



                v : to begin visual selection (assuming you are already at the bottom of the screen)



                gg : to capture everything in the scrollback



                y : to yank it into the buffer



                Prefixc : open another tmux window



                vim scrollback.txt


                i : enter insert mode in vim



                Prefixp : paste into file



                There is also an answer here describing how to copy the buffer to a temporary file using xsel that might be useful.






                share|improve this answer




















                • 2





                  This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

                  – Konrad Rudolph
                  Jan 21 '15 at 16:19






                • 10





                  If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

                  – tlunter
                  Feb 4 '15 at 21:18











                • @tlunter nice tip!

                  – jasonwryan
                  Feb 4 '15 at 23:10











                • Can this be done with default key bindings?

                  – daveloyall
                  Nov 5 '15 at 17:00











                • @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

                  – jasonwryan
                  Nov 5 '15 at 17:14















                49














                This depends on the value of history-limit that you have set in your .tmux.conf - the default is 2000; if you wish to capture more, you will need to explicitly set the number of lines.



                To capture the entire scrollback, enter copy mode, select the entire scrollback, and yank it into the buffer, then paste it into your file.



                How you accomplish this will depend on the mode-keys option you prefer, vi or emacs. man tmux has a helpful table describing the respective keys.



                I have the following in my .tmux.conf to simplify this:



                unbind [
                bind Escape copy-mode
                unbind p
                bind p paste-buffer
                bind-key -t vi-copy 'v' begin-selection
                bind-key -t vi-copy 'y' copy-selection



                The process for capturing the full scrollback is then:



                PrefixEsc : to enter copy mode



                v : to begin visual selection (assuming you are already at the bottom of the screen)



                gg : to capture everything in the scrollback



                y : to yank it into the buffer



                Prefixc : open another tmux window



                vim scrollback.txt


                i : enter insert mode in vim



                Prefixp : paste into file



                There is also an answer here describing how to copy the buffer to a temporary file using xsel that might be useful.






                share|improve this answer




















                • 2





                  This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

                  – Konrad Rudolph
                  Jan 21 '15 at 16:19






                • 10





                  If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

                  – tlunter
                  Feb 4 '15 at 21:18











                • @tlunter nice tip!

                  – jasonwryan
                  Feb 4 '15 at 23:10











                • Can this be done with default key bindings?

                  – daveloyall
                  Nov 5 '15 at 17:00











                • @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

                  – jasonwryan
                  Nov 5 '15 at 17:14













                49












                49








                49







                This depends on the value of history-limit that you have set in your .tmux.conf - the default is 2000; if you wish to capture more, you will need to explicitly set the number of lines.



                To capture the entire scrollback, enter copy mode, select the entire scrollback, and yank it into the buffer, then paste it into your file.



                How you accomplish this will depend on the mode-keys option you prefer, vi or emacs. man tmux has a helpful table describing the respective keys.



                I have the following in my .tmux.conf to simplify this:



                unbind [
                bind Escape copy-mode
                unbind p
                bind p paste-buffer
                bind-key -t vi-copy 'v' begin-selection
                bind-key -t vi-copy 'y' copy-selection



                The process for capturing the full scrollback is then:



                PrefixEsc : to enter copy mode



                v : to begin visual selection (assuming you are already at the bottom of the screen)



                gg : to capture everything in the scrollback



                y : to yank it into the buffer



                Prefixc : open another tmux window



                vim scrollback.txt


                i : enter insert mode in vim



                Prefixp : paste into file



                There is also an answer here describing how to copy the buffer to a temporary file using xsel that might be useful.






                share|improve this answer















                This depends on the value of history-limit that you have set in your .tmux.conf - the default is 2000; if you wish to capture more, you will need to explicitly set the number of lines.



                To capture the entire scrollback, enter copy mode, select the entire scrollback, and yank it into the buffer, then paste it into your file.



                How you accomplish this will depend on the mode-keys option you prefer, vi or emacs. man tmux has a helpful table describing the respective keys.



                I have the following in my .tmux.conf to simplify this:



                unbind [
                bind Escape copy-mode
                unbind p
                bind p paste-buffer
                bind-key -t vi-copy 'v' begin-selection
                bind-key -t vi-copy 'y' copy-selection



                The process for capturing the full scrollback is then:



                PrefixEsc : to enter copy mode



                v : to begin visual selection (assuming you are already at the bottom of the screen)



                gg : to capture everything in the scrollback



                y : to yank it into the buffer



                Prefixc : open another tmux window



                vim scrollback.txt


                i : enter insert mode in vim



                Prefixp : paste into file



                There is also an answer here describing how to copy the buffer to a temporary file using xsel that might be useful.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 13 '17 at 12:36









                Community

                1




                1










                answered Dec 10 '11 at 21:44









                jasonwryanjasonwryan

                50k14134188




                50k14134188







                • 2





                  This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

                  – Konrad Rudolph
                  Jan 21 '15 at 16:19






                • 10





                  If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

                  – tlunter
                  Feb 4 '15 at 21:18











                • @tlunter nice tip!

                  – jasonwryan
                  Feb 4 '15 at 23:10











                • Can this be done with default key bindings?

                  – daveloyall
                  Nov 5 '15 at 17:00











                • @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

                  – jasonwryan
                  Nov 5 '15 at 17:14












                • 2





                  This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

                  – Konrad Rudolph
                  Jan 21 '15 at 16:19






                • 10





                  If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

                  – tlunter
                  Feb 4 '15 at 21:18











                • @tlunter nice tip!

                  – jasonwryan
                  Feb 4 '15 at 23:10











                • Can this be done with default key bindings?

                  – daveloyall
                  Nov 5 '15 at 17:00











                • @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

                  – jasonwryan
                  Nov 5 '15 at 17:14







                2




                2





                This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

                – Konrad Rudolph
                Jan 21 '15 at 16:19





                This is problematic at best … pasting into insert mode in Vim has all kinds of problems, e.g. when you have automatic indentation enabled. I never got this to work to my satisfaction.

                – Konrad Rudolph
                Jan 21 '15 at 16:19




                10




                10





                If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

                – tlunter
                Feb 4 '15 at 21:18





                If you use :set paste in vim, vim will ignore adding automatic indentations or any insert-based keybindings.

                – tlunter
                Feb 4 '15 at 21:18













                @tlunter nice tip!

                – jasonwryan
                Feb 4 '15 at 23:10





                @tlunter nice tip!

                – jasonwryan
                Feb 4 '15 at 23:10













                Can this be done with default key bindings?

                – daveloyall
                Nov 5 '15 at 17:00





                Can this be done with default key bindings?

                – daveloyall
                Nov 5 '15 at 17:00













                @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

                – jasonwryan
                Nov 5 '15 at 17:14





                @daveloyall Of course, just don't use the keybind options I included from my .tmux.conf...

                – jasonwryan
                Nov 5 '15 at 17:14













                158














                For those looking for a simple answer, just use prefix + :, then type in capture-pane -S -3000 + return (Replace 3000 with however many lines you'd like to save.) This copies those lines into a buffer.



                Then, to save the buffer to a file, just use prefix + : again, and type in save-buffer filename.txt + return, replacing filename with whatever you'd like.



                (By default prefix is ctrl + b.)






                share|improve this answer




















                • 8





                  save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

                  – MohamedEzz
                  Dec 8 '16 at 9:54






                • 10





                  and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

                  – Yordan Georgiev
                  Dec 23 '16 at 12:46






                • 8





                  This is the best answer here. Thank you so much.

                  – Jesse Atkinson
                  Apr 21 '17 at 21:22






                • 6





                  Yes, you win. This should be the top answer.

                  – wordsforthewise
                  Jun 6 '17 at 19:39















                158














                For those looking for a simple answer, just use prefix + :, then type in capture-pane -S -3000 + return (Replace 3000 with however many lines you'd like to save.) This copies those lines into a buffer.



                Then, to save the buffer to a file, just use prefix + : again, and type in save-buffer filename.txt + return, replacing filename with whatever you'd like.



                (By default prefix is ctrl + b.)






                share|improve this answer




















                • 8





                  save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

                  – MohamedEzz
                  Dec 8 '16 at 9:54






                • 10





                  and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

                  – Yordan Georgiev
                  Dec 23 '16 at 12:46






                • 8





                  This is the best answer here. Thank you so much.

                  – Jesse Atkinson
                  Apr 21 '17 at 21:22






                • 6





                  Yes, you win. This should be the top answer.

                  – wordsforthewise
                  Jun 6 '17 at 19:39













                158












                158








                158







                For those looking for a simple answer, just use prefix + :, then type in capture-pane -S -3000 + return (Replace 3000 with however many lines you'd like to save.) This copies those lines into a buffer.



                Then, to save the buffer to a file, just use prefix + : again, and type in save-buffer filename.txt + return, replacing filename with whatever you'd like.



                (By default prefix is ctrl + b.)






                share|improve this answer















                For those looking for a simple answer, just use prefix + :, then type in capture-pane -S -3000 + return (Replace 3000 with however many lines you'd like to save.) This copies those lines into a buffer.



                Then, to save the buffer to a file, just use prefix + : again, and type in save-buffer filename.txt + return, replacing filename with whatever you'd like.



                (By default prefix is ctrl + b.)







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Dec 17 '15 at 17:16

























                answered Oct 17 '15 at 14:59









                Sauce McBossSauce McBoss

                1,921277




                1,921277







                • 8





                  save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

                  – MohamedEzz
                  Dec 8 '16 at 9:54






                • 10





                  and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

                  – Yordan Georgiev
                  Dec 23 '16 at 12:46






                • 8





                  This is the best answer here. Thank you so much.

                  – Jesse Atkinson
                  Apr 21 '17 at 21:22






                • 6





                  Yes, you win. This should be the top answer.

                  – wordsforthewise
                  Jun 6 '17 at 19:39












                • 8





                  save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

                  – MohamedEzz
                  Dec 8 '16 at 9:54






                • 10





                  and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

                  – Yordan Georgiev
                  Dec 23 '16 at 12:46






                • 8





                  This is the best answer here. Thank you so much.

                  – Jesse Atkinson
                  Apr 21 '17 at 21:22






                • 6





                  Yes, you win. This should be the top answer.

                  – wordsforthewise
                  Jun 6 '17 at 19:39







                8




                8





                save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

                – MohamedEzz
                Dec 8 '16 at 9:54





                save-buffer filename.txt seems to save the file in /, not in pwd (current directory). Instead, I provided an absolute file path and it worked like a charm

                – MohamedEzz
                Dec 8 '16 at 9:54




                10




                10





                and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

                – Yordan Georgiev
                Dec 23 '16 at 12:46





                and don't forget that MINUS in front of the <<amount-of-buffer-lines-you-want-to-save>>

                – Yordan Georgiev
                Dec 23 '16 at 12:46




                8




                8





                This is the best answer here. Thank you so much.

                – Jesse Atkinson
                Apr 21 '17 at 21:22





                This is the best answer here. Thank you so much.

                – Jesse Atkinson
                Apr 21 '17 at 21:22




                6




                6





                Yes, you win. This should be the top answer.

                – wordsforthewise
                Jun 6 '17 at 19:39





                Yes, you win. This should be the top answer.

                – wordsforthewise
                Jun 6 '17 at 19:39











                148














                With tmux 1.5, the capture-pane command accepts -S and -E to specify the start and end lines of the capture; negative values can be used to specify lines from the history. Once you have the data in a buffer, you can save it with save-buffer.



                Here is an example binding (suitable for .tmux.conf) that wraps it all up with a prompt for the filename:



                bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'


                This captures (up to) 32768 lines of history plus the currently displayed lines. Starting with tmux 1.6, you can use numbers down to INT_MIN if your pane has a history that is deeper than 32Ki lines (usually up to 2Gi lines). Starting in tmux 2.0, you can use capture-pane -S - to mean “start at the beginning of history” (i.e. no large, hard-coded negative number).




                Note: The number of lines in the saved file will not always be equal to the pane’s history limit plus its height.



                When a pane’s history buffer is full, tmux discards the oldest 10% of the lines instead of discarding just one line. This means a pane’s effective history depth will sometimes be as low as 90% of its configured limit.






                share|improve this answer




















                • 1





                  You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

                  – Chris Johnsen
                  Dec 12 '11 at 8:03






                • 1





                  This is by far one of the most useful tmux commands I have found.

                  – kenny
                  Jul 19 '12 at 19:03






                • 1





                  And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

                  – Ali
                  Dec 17 '13 at 21:43






                • 1





                  @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

                  – Aleksandr Dubinsky
                  Jul 5 '17 at 21:07






                • 1





                  @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

                  – Aleksandr Dubinsky
                  Jul 15 '17 at 5:24















                148














                With tmux 1.5, the capture-pane command accepts -S and -E to specify the start and end lines of the capture; negative values can be used to specify lines from the history. Once you have the data in a buffer, you can save it with save-buffer.



                Here is an example binding (suitable for .tmux.conf) that wraps it all up with a prompt for the filename:



                bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'


                This captures (up to) 32768 lines of history plus the currently displayed lines. Starting with tmux 1.6, you can use numbers down to INT_MIN if your pane has a history that is deeper than 32Ki lines (usually up to 2Gi lines). Starting in tmux 2.0, you can use capture-pane -S - to mean “start at the beginning of history” (i.e. no large, hard-coded negative number).




                Note: The number of lines in the saved file will not always be equal to the pane’s history limit plus its height.



                When a pane’s history buffer is full, tmux discards the oldest 10% of the lines instead of discarding just one line. This means a pane’s effective history depth will sometimes be as low as 90% of its configured limit.






                share|improve this answer




















                • 1





                  You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

                  – Chris Johnsen
                  Dec 12 '11 at 8:03






                • 1





                  This is by far one of the most useful tmux commands I have found.

                  – kenny
                  Jul 19 '12 at 19:03






                • 1





                  And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

                  – Ali
                  Dec 17 '13 at 21:43






                • 1





                  @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

                  – Aleksandr Dubinsky
                  Jul 5 '17 at 21:07






                • 1





                  @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

                  – Aleksandr Dubinsky
                  Jul 15 '17 at 5:24













                148












                148








                148







                With tmux 1.5, the capture-pane command accepts -S and -E to specify the start and end lines of the capture; negative values can be used to specify lines from the history. Once you have the data in a buffer, you can save it with save-buffer.



                Here is an example binding (suitable for .tmux.conf) that wraps it all up with a prompt for the filename:



                bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'


                This captures (up to) 32768 lines of history plus the currently displayed lines. Starting with tmux 1.6, you can use numbers down to INT_MIN if your pane has a history that is deeper than 32Ki lines (usually up to 2Gi lines). Starting in tmux 2.0, you can use capture-pane -S - to mean “start at the beginning of history” (i.e. no large, hard-coded negative number).




                Note: The number of lines in the saved file will not always be equal to the pane’s history limit plus its height.



                When a pane’s history buffer is full, tmux discards the oldest 10% of the lines instead of discarding just one line. This means a pane’s effective history depth will sometimes be as low as 90% of its configured limit.






                share|improve this answer















                With tmux 1.5, the capture-pane command accepts -S and -E to specify the start and end lines of the capture; negative values can be used to specify lines from the history. Once you have the data in a buffer, you can save it with save-buffer.



                Here is an example binding (suitable for .tmux.conf) that wraps it all up with a prompt for the filename:



                bind-key P command-prompt -p 'save history to filename:' -I '~/tmux.history' 'capture-pane -S -32768 ; save-buffer %1 ; delete-buffer'


                This captures (up to) 32768 lines of history plus the currently displayed lines. Starting with tmux 1.6, you can use numbers down to INT_MIN if your pane has a history that is deeper than 32Ki lines (usually up to 2Gi lines). Starting in tmux 2.0, you can use capture-pane -S - to mean “start at the beginning of history” (i.e. no large, hard-coded negative number).




                Note: The number of lines in the saved file will not always be equal to the pane’s history limit plus its height.



                When a pane’s history buffer is full, tmux discards the oldest 10% of the lines instead of discarding just one line. This means a pane’s effective history depth will sometimes be as low as 90% of its configured limit.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited May 26 '15 at 2:48

























                answered Dec 11 '11 at 6:32









                Chris JohnsenChris Johnsen

                14.8k64847




                14.8k64847







                • 1





                  You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

                  – Chris Johnsen
                  Dec 12 '11 at 8:03






                • 1





                  This is by far one of the most useful tmux commands I have found.

                  – kenny
                  Jul 19 '12 at 19:03






                • 1





                  And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

                  – Ali
                  Dec 17 '13 at 21:43






                • 1





                  @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

                  – Aleksandr Dubinsky
                  Jul 5 '17 at 21:07






                • 1





                  @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

                  – Aleksandr Dubinsky
                  Jul 15 '17 at 5:24












                • 1





                  You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

                  – Chris Johnsen
                  Dec 12 '11 at 8:03






                • 1





                  This is by far one of the most useful tmux commands I have found.

                  – kenny
                  Jul 19 '12 at 19:03






                • 1





                  And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

                  – Ali
                  Dec 17 '13 at 21:43






                • 1





                  @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

                  – Aleksandr Dubinsky
                  Jul 5 '17 at 21:07






                • 1





                  @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

                  – Aleksandr Dubinsky
                  Jul 15 '17 at 5:24







                1




                1





                You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

                – Chris Johnsen
                Dec 12 '11 at 8:03





                You probably are running tmux 1.3; you can probably use tmux server-info | head -1 to see your version. tmux -V works in tmux* 1.4 and later.

                – Chris Johnsen
                Dec 12 '11 at 8:03




                1




                1





                This is by far one of the most useful tmux commands I have found.

                – kenny
                Jul 19 '12 at 19:03





                This is by far one of the most useful tmux commands I have found.

                – kenny
                Jul 19 '12 at 19:03




                1




                1





                And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

                – Ali
                Dec 17 '13 at 21:43





                And if you are already in your tmux window and don't want to restart just do a [PrefixKey] : to get to the tmux command line, and then paste the whole line, then you just do a [Prefix] P it is capital P and you are good to go.

                – Ali
                Dec 17 '13 at 21:43




                1




                1





                @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

                – Aleksandr Dubinsky
                Jul 5 '17 at 21:07





                @BradenBest An SI prefix need to be attached to a unit. Neither "32Ki" nor "32K" is valid. Nevermind that uppercase K is not an SI prefix. Nice job being on the side of confusion-sowing pedants and getting it wrong.

                – Aleksandr Dubinsky
                Jul 5 '17 at 21:07




                1




                1





                @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

                – Aleksandr Dubinsky
                Jul 15 '17 at 5:24





                @BradenBest The binary prefixes sow confusion because 1 MB used to have an exact meaning, but now it has two meanings. Worse, the decimal meaning is useless to the IT industry, except to storage manufacturers who use it for false marketing. This confusion was started by pedants who refused to be practical. If you yourself are not such a pedant, then I apologize for my tone and urge you to reconsider your enthusiasm for binary prefixes.

                – Aleksandr Dubinsky
                Jul 15 '17 at 5:24











                18














                I had standard key bindings which appeared to be a bit different than in @jasonwryan's answer and didn't change anything in config.



                Below is recipe that worked for me. Maybe you will find it useful if you don't want to make any changes in tmux config and just want to quickly copy some of the scrollback.



                Prefix == Ctrl+b in my tmux (tmux 1.6, debian 7).



                1. Enter select mode: Prefix + [.

                2. Start selection: Space.

                3. Highlight necessary text using vim navigation (for instance, use arrow keys or press gg to reach beginning of output history).

                4. Actually copy in internal clipboard using Enter. You will be exited from copy mode.

                5. Open any file using vim (probably on new tmux tab) and paste content you copied before using Prefix + ].

                6. Then you may do cat of that file or use output how you need.





                share|improve this answer

























                • man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

                  – Cognitiaclaeves
                  Aug 4 '17 at 1:29















                18














                I had standard key bindings which appeared to be a bit different than in @jasonwryan's answer and didn't change anything in config.



                Below is recipe that worked for me. Maybe you will find it useful if you don't want to make any changes in tmux config and just want to quickly copy some of the scrollback.



                Prefix == Ctrl+b in my tmux (tmux 1.6, debian 7).



                1. Enter select mode: Prefix + [.

                2. Start selection: Space.

                3. Highlight necessary text using vim navigation (for instance, use arrow keys or press gg to reach beginning of output history).

                4. Actually copy in internal clipboard using Enter. You will be exited from copy mode.

                5. Open any file using vim (probably on new tmux tab) and paste content you copied before using Prefix + ].

                6. Then you may do cat of that file or use output how you need.





                share|improve this answer

























                • man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

                  – Cognitiaclaeves
                  Aug 4 '17 at 1:29













                18












                18








                18







                I had standard key bindings which appeared to be a bit different than in @jasonwryan's answer and didn't change anything in config.



                Below is recipe that worked for me. Maybe you will find it useful if you don't want to make any changes in tmux config and just want to quickly copy some of the scrollback.



                Prefix == Ctrl+b in my tmux (tmux 1.6, debian 7).



                1. Enter select mode: Prefix + [.

                2. Start selection: Space.

                3. Highlight necessary text using vim navigation (for instance, use arrow keys or press gg to reach beginning of output history).

                4. Actually copy in internal clipboard using Enter. You will be exited from copy mode.

                5. Open any file using vim (probably on new tmux tab) and paste content you copied before using Prefix + ].

                6. Then you may do cat of that file or use output how you need.





                share|improve this answer















                I had standard key bindings which appeared to be a bit different than in @jasonwryan's answer and didn't change anything in config.



                Below is recipe that worked for me. Maybe you will find it useful if you don't want to make any changes in tmux config and just want to quickly copy some of the scrollback.



                Prefix == Ctrl+b in my tmux (tmux 1.6, debian 7).



                1. Enter select mode: Prefix + [.

                2. Start selection: Space.

                3. Highlight necessary text using vim navigation (for instance, use arrow keys or press gg to reach beginning of output history).

                4. Actually copy in internal clipboard using Enter. You will be exited from copy mode.

                5. Open any file using vim (probably on new tmux tab) and paste content you copied before using Prefix + ].

                6. Then you may do cat of that file or use output how you need.






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Apr 13 '17 at 12:36









                Community

                1




                1










                answered Feb 14 '14 at 10:58









                AlexAlex

                28124




                28124












                • man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

                  – Cognitiaclaeves
                  Aug 4 '17 at 1:29

















                • man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

                  – Cognitiaclaeves
                  Aug 4 '17 at 1:29
















                man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

                – Cognitiaclaeves
                Aug 4 '17 at 1:29





                man tmux helped me to sort out that my tmux was in emacs mode, so none of the key-bindings above worked. man tmux, again, helped me sort out what to use. But the biggest mistake that I made was that the host that I saved the contents from was not the host that I was running tmux from, so I kept looking for the saved file on the wrong host ...

                – Cognitiaclaeves
                Aug 4 '17 at 1:29











                11














                Here's a tmux plugin that enables this:



                https://github.com/tmux-plugins/tmux-logging



                After you install it, save the entire scrollback with prefix + alt-shift-p.






                share|improve this answer



























                  11














                  Here's a tmux plugin that enables this:



                  https://github.com/tmux-plugins/tmux-logging



                  After you install it, save the entire scrollback with prefix + alt-shift-p.






                  share|improve this answer

























                    11












                    11








                    11







                    Here's a tmux plugin that enables this:



                    https://github.com/tmux-plugins/tmux-logging



                    After you install it, save the entire scrollback with prefix + alt-shift-p.






                    share|improve this answer













                    Here's a tmux plugin that enables this:



                    https://github.com/tmux-plugins/tmux-logging



                    After you install it, save the entire scrollback with prefix + alt-shift-p.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Aug 30 '14 at 12:56









                    Bruno SuticBruno Sutic

                    43348




                    43348





















                        9














                        If you want something you can run from the command line (instead of using your tmux prefix keys), try running:



                        tmux capture-pane -pS -1000000


                        If you run it and it seems to not do anything, that's because it's outputting exactly what was just on your screen, so it looks the same.



                        Of course, you can also pipe it into a file:



                        tmux capture-pane -pS -1000000 > file.out


                        See the tmux man page and search for capture-pane for more things you can do (like capture escape sequences in case you want to preserve color, or specify whether you want multiple visual lines to be joined when they don't contain a new line)






                        share|improve this answer























                        • This is very helpful, especially since the accepted answer no longer works.

                          – piojo
                          Jan 16 at 7:22















                        9














                        If you want something you can run from the command line (instead of using your tmux prefix keys), try running:



                        tmux capture-pane -pS -1000000


                        If you run it and it seems to not do anything, that's because it's outputting exactly what was just on your screen, so it looks the same.



                        Of course, you can also pipe it into a file:



                        tmux capture-pane -pS -1000000 > file.out


                        See the tmux man page and search for capture-pane for more things you can do (like capture escape sequences in case you want to preserve color, or specify whether you want multiple visual lines to be joined when they don't contain a new line)






                        share|improve this answer























                        • This is very helpful, especially since the accepted answer no longer works.

                          – piojo
                          Jan 16 at 7:22













                        9












                        9








                        9







                        If you want something you can run from the command line (instead of using your tmux prefix keys), try running:



                        tmux capture-pane -pS -1000000


                        If you run it and it seems to not do anything, that's because it's outputting exactly what was just on your screen, so it looks the same.



                        Of course, you can also pipe it into a file:



                        tmux capture-pane -pS -1000000 > file.out


                        See the tmux man page and search for capture-pane for more things you can do (like capture escape sequences in case you want to preserve color, or specify whether you want multiple visual lines to be joined when they don't contain a new line)






                        share|improve this answer













                        If you want something you can run from the command line (instead of using your tmux prefix keys), try running:



                        tmux capture-pane -pS -1000000


                        If you run it and it seems to not do anything, that's because it's outputting exactly what was just on your screen, so it looks the same.



                        Of course, you can also pipe it into a file:



                        tmux capture-pane -pS -1000000 > file.out


                        See the tmux man page and search for capture-pane for more things you can do (like capture escape sequences in case you want to preserve color, or specify whether you want multiple visual lines to be joined when they don't contain a new line)







                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered May 7 '18 at 23:21









                        Christopher ShrobaChristopher Shroba

                        23327




                        23327












                        • This is very helpful, especially since the accepted answer no longer works.

                          – piojo
                          Jan 16 at 7:22

















                        • This is very helpful, especially since the accepted answer no longer works.

                          – piojo
                          Jan 16 at 7:22
















                        This is very helpful, especially since the accepted answer no longer works.

                        – piojo
                        Jan 16 at 7:22





                        This is very helpful, especially since the accepted answer no longer works.

                        – piojo
                        Jan 16 at 7:22











                        2














                        This is actually very easy.
                        Enter the command mode by press prefix key then :.
                        Then do capture-pane -S -<line number you want to dump>
                        Then save-buffer <filepath>



                        That file contains all the scrollback output. You should delete the buffer afterwards for safety reason.






                        share|improve this answer



























                          2














                          This is actually very easy.
                          Enter the command mode by press prefix key then :.
                          Then do capture-pane -S -<line number you want to dump>
                          Then save-buffer <filepath>



                          That file contains all the scrollback output. You should delete the buffer afterwards for safety reason.






                          share|improve this answer

























                            2












                            2








                            2







                            This is actually very easy.
                            Enter the command mode by press prefix key then :.
                            Then do capture-pane -S -<line number you want to dump>
                            Then save-buffer <filepath>



                            That file contains all the scrollback output. You should delete the buffer afterwards for safety reason.






                            share|improve this answer













                            This is actually very easy.
                            Enter the command mode by press prefix key then :.
                            Then do capture-pane -S -<line number you want to dump>
                            Then save-buffer <filepath>



                            That file contains all the scrollback output. You should delete the buffer afterwards for safety reason.







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Jan 24 '18 at 15:10









                            WangWang

                            266314




                            266314





















                                0















                                How can I write all the scrollback in a tmux session to a file?




                                I use this in my ~/.tmux.conf, and now when I exit my running shell, pane output is saved to unique log file:



                                set -g remain-on-exit
                                set-hook pane-died 'capture-pane -S - -E - ; save-buffer "$HOME/logs/tmux/tmux-saved.#host_short-#session_id:#window_id:#pane_id-#pane_pid-#client_activity.log"; delete-buffer; kill-pane'





                                share|improve this answer



























                                  0















                                  How can I write all the scrollback in a tmux session to a file?




                                  I use this in my ~/.tmux.conf, and now when I exit my running shell, pane output is saved to unique log file:



                                  set -g remain-on-exit
                                  set-hook pane-died 'capture-pane -S - -E - ; save-buffer "$HOME/logs/tmux/tmux-saved.#host_short-#session_id:#window_id:#pane_id-#pane_pid-#client_activity.log"; delete-buffer; kill-pane'





                                  share|improve this answer

























                                    0












                                    0








                                    0








                                    How can I write all the scrollback in a tmux session to a file?




                                    I use this in my ~/.tmux.conf, and now when I exit my running shell, pane output is saved to unique log file:



                                    set -g remain-on-exit
                                    set-hook pane-died 'capture-pane -S - -E - ; save-buffer "$HOME/logs/tmux/tmux-saved.#host_short-#session_id:#window_id:#pane_id-#pane_pid-#client_activity.log"; delete-buffer; kill-pane'





                                    share|improve this answer














                                    How can I write all the scrollback in a tmux session to a file?




                                    I use this in my ~/.tmux.conf, and now when I exit my running shell, pane output is saved to unique log file:



                                    set -g remain-on-exit
                                    set-hook pane-died 'capture-pane -S - -E - ; save-buffer "$HOME/logs/tmux/tmux-saved.#host_short-#session_id:#window_id:#pane_id-#pane_pid-#client_activity.log"; delete-buffer; kill-pane'






                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Jan 25 at 19:42









                                    user2688272user2688272

                                    9112




                                    9112



























                                        draft saved

                                        draft discarded
















































                                        Thanks for contributing an answer to Unix & Linux Stack Exchange!


                                        • 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%2funix.stackexchange.com%2fquestions%2f26548%2fwrite-all-tmux-scrollback-to-a-file%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

                                        How to check contact read email or not when send email to Individual?

                                        Displaying single band from multi-band raster using QGIS

                                        How many registers does an x86_64 CPU actually have?