Existing command line text on screen to file? (non-graphical Linux)












9















On tty2, how do I take a text screenshot of the command line?










share|improve this question


















  • 1





    Related: Where is terminal output stored?

    – sondra.kinsey
    Nov 30 '18 at 19:51
















9















On tty2, how do I take a text screenshot of the command line?










share|improve this question


















  • 1





    Related: Where is terminal output stored?

    – sondra.kinsey
    Nov 30 '18 at 19:51














9












9








9








On tty2, how do I take a text screenshot of the command line?










share|improve this question














On tty2, how do I take a text screenshot of the command line?







command-line text






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 24 '18 at 16:36









neverMind9neverMind9

641317




641317








  • 1





    Related: Where is terminal output stored?

    – sondra.kinsey
    Nov 30 '18 at 19:51














  • 1





    Related: Where is terminal output stored?

    – sondra.kinsey
    Nov 30 '18 at 19:51








1




1





Related: Where is terminal output stored?

– sondra.kinsey
Nov 30 '18 at 19:51





Related: Where is terminal output stored?

– sondra.kinsey
Nov 30 '18 at 19:51










3 Answers
3






active

oldest

votes


















4














If you can use tmux or screen, they have the ability to save the scrollback buffer to a file.




  • Write all tmux scrollback to a file

  • Copying GNU screen scrollback buffer to file (extended hardcopy)?


Unlike screendump, which is Linux-only, tmux and screen are available for BSD-based OSes too (e.g. macOS, FreeBSD) and won't require special permissions.






share|improve this answer


























  • Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

    – neverMind9
    Nov 25 '18 at 10:28











  • Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

    – RudiC
    Nov 25 '18 at 11:54



















13














Did you consider the screendump command?






share|improve this answer



















  • 3





    "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

    – Weijun Zhou
    Nov 24 '18 at 16:45






  • 5





    Try it and see.

    – RudiC
    Nov 24 '18 at 16:46











  • Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

    – kasperd
    Nov 25 '18 at 13:25











  • @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

    – kasperd
    Nov 25 '18 at 13:26



















2














You can use script for this. It will record a typescript of the terminal session. By default, it will write to ./typescript. Of course, you need to do this in advance so it is not really a "screenshot".



$ script
Script started, file is typescript
$ ls asdf
ls: cannot access asdf: No such file or directory
$ exit
Script done, file is typescript

# Then check the recordings:

$ cat typescript
Script started on Thu 29 Nov 2018 02:52:04 PM CET

$ ls asdf
ls: cannot access asf: No such file or directory
$ exit

Script done on Thu 29 Nov 2018 02:52:09 PM CET





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%2f483894%2fexisting-command-line-text-on-screen-to-file-non-graphical-linux%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    If you can use tmux or screen, they have the ability to save the scrollback buffer to a file.




    • Write all tmux scrollback to a file

    • Copying GNU screen scrollback buffer to file (extended hardcopy)?


    Unlike screendump, which is Linux-only, tmux and screen are available for BSD-based OSes too (e.g. macOS, FreeBSD) and won't require special permissions.






    share|improve this answer


























    • Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

      – neverMind9
      Nov 25 '18 at 10:28











    • Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

      – RudiC
      Nov 25 '18 at 11:54
















    4














    If you can use tmux or screen, they have the ability to save the scrollback buffer to a file.




    • Write all tmux scrollback to a file

    • Copying GNU screen scrollback buffer to file (extended hardcopy)?


    Unlike screendump, which is Linux-only, tmux and screen are available for BSD-based OSes too (e.g. macOS, FreeBSD) and won't require special permissions.






    share|improve this answer


























    • Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

      – neverMind9
      Nov 25 '18 at 10:28











    • Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

      – RudiC
      Nov 25 '18 at 11:54














    4












    4








    4







    If you can use tmux or screen, they have the ability to save the scrollback buffer to a file.




    • Write all tmux scrollback to a file

    • Copying GNU screen scrollback buffer to file (extended hardcopy)?


    Unlike screendump, which is Linux-only, tmux and screen are available for BSD-based OSes too (e.g. macOS, FreeBSD) and won't require special permissions.






    share|improve this answer















    If you can use tmux or screen, they have the ability to save the scrollback buffer to a file.




    • Write all tmux scrollback to a file

    • Copying GNU screen scrollback buffer to file (extended hardcopy)?


    Unlike screendump, which is Linux-only, tmux and screen are available for BSD-based OSes too (e.g. macOS, FreeBSD) and won't require special permissions.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 25 '18 at 18:56

























    answered Nov 25 '18 at 6:29









    jamesdlinjamesdlin

    554413




    554413













    • Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

      – neverMind9
      Nov 25 '18 at 10:28











    • Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

      – RudiC
      Nov 25 '18 at 11:54



















    • Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

      – neverMind9
      Nov 25 '18 at 10:28











    • Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

      – RudiC
      Nov 25 '18 at 11:54

















    Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

    – neverMind9
    Nov 25 '18 at 10:28





    Because of that, I marked this one as accepted. But @RudiC Don't take it personally. Your solution is still the simplest.

    – neverMind9
    Nov 25 '18 at 10:28













    Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

    – RudiC
    Nov 25 '18 at 11:54





    Those two add another layer; you need to login and then run screen, have another shell, and then can communicate with your CLI.

    – RudiC
    Nov 25 '18 at 11:54













    13














    Did you consider the screendump command?






    share|improve this answer



















    • 3





      "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

      – Weijun Zhou
      Nov 24 '18 at 16:45






    • 5





      Try it and see.

      – RudiC
      Nov 24 '18 at 16:46











    • Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

      – kasperd
      Nov 25 '18 at 13:25











    • @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

      – kasperd
      Nov 25 '18 at 13:26
















    13














    Did you consider the screendump command?






    share|improve this answer



















    • 3





      "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

      – Weijun Zhou
      Nov 24 '18 at 16:45






    • 5





      Try it and see.

      – RudiC
      Nov 24 '18 at 16:46











    • Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

      – kasperd
      Nov 25 '18 at 13:25











    • @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

      – kasperd
      Nov 25 '18 at 13:26














    13












    13








    13







    Did you consider the screendump command?






    share|improve this answer













    Did you consider the screendump command?







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 24 '18 at 16:39









    RudiCRudiC

    4,2541312




    4,2541312








    • 3





      "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

      – Weijun Zhou
      Nov 24 '18 at 16:45






    • 5





      Try it and see.

      – RudiC
      Nov 24 '18 at 16:46











    • Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

      – kasperd
      Nov 25 '18 at 13:25











    • @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

      – kasperd
      Nov 25 '18 at 13:26














    • 3





      "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

      – Weijun Zhou
      Nov 24 '18 at 16:45






    • 5





      Try it and see.

      – RudiC
      Nov 24 '18 at 16:46











    • Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

      – kasperd
      Nov 25 '18 at 13:25











    • @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

      – kasperd
      Nov 25 '18 at 13:26








    3




    3





    "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

    – Weijun Zhou
    Nov 24 '18 at 16:45





    "Just saying cat /dev/vcsN has a similar effect". Then why not just use cat /dev/vcsN?

    – Weijun Zhou
    Nov 24 '18 at 16:45




    5




    5





    Try it and see.

    – RudiC
    Nov 24 '18 at 16:46





    Try it and see.

    – RudiC
    Nov 24 '18 at 16:46













    Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

    – kasperd
    Nov 25 '18 at 13:25





    Nice. Is there a way to get it to do colour as well? (screendump reads from /dev/vcsa devices which does have colour information, but it seems to be stripped from the output.) Btw. I like to combine it with the watch command to see live output like watch -n0.1 screendump.

    – kasperd
    Nov 25 '18 at 13:25













    @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

    – kasperd
    Nov 25 '18 at 13:26





    @WeijunZhou /dev/vcs devices don't contain information about the size of the screen, so cat /dev/vcsN only works if your terminal window has the same number of characters across as the VC you are capturing.

    – kasperd
    Nov 25 '18 at 13:26











    2














    You can use script for this. It will record a typescript of the terminal session. By default, it will write to ./typescript. Of course, you need to do this in advance so it is not really a "screenshot".



    $ script
    Script started, file is typescript
    $ ls asdf
    ls: cannot access asdf: No such file or directory
    $ exit
    Script done, file is typescript

    # Then check the recordings:

    $ cat typescript
    Script started on Thu 29 Nov 2018 02:52:04 PM CET

    $ ls asdf
    ls: cannot access asf: No such file or directory
    $ exit

    Script done on Thu 29 Nov 2018 02:52:09 PM CET





    share|improve this answer




























      2














      You can use script for this. It will record a typescript of the terminal session. By default, it will write to ./typescript. Of course, you need to do this in advance so it is not really a "screenshot".



      $ script
      Script started, file is typescript
      $ ls asdf
      ls: cannot access asdf: No such file or directory
      $ exit
      Script done, file is typescript

      # Then check the recordings:

      $ cat typescript
      Script started on Thu 29 Nov 2018 02:52:04 PM CET

      $ ls asdf
      ls: cannot access asf: No such file or directory
      $ exit

      Script done on Thu 29 Nov 2018 02:52:09 PM CET





      share|improve this answer


























        2












        2








        2







        You can use script for this. It will record a typescript of the terminal session. By default, it will write to ./typescript. Of course, you need to do this in advance so it is not really a "screenshot".



        $ script
        Script started, file is typescript
        $ ls asdf
        ls: cannot access asdf: No such file or directory
        $ exit
        Script done, file is typescript

        # Then check the recordings:

        $ cat typescript
        Script started on Thu 29 Nov 2018 02:52:04 PM CET

        $ ls asdf
        ls: cannot access asf: No such file or directory
        $ exit

        Script done on Thu 29 Nov 2018 02:52:09 PM CET





        share|improve this answer













        You can use script for this. It will record a typescript of the terminal session. By default, it will write to ./typescript. Of course, you need to do this in advance so it is not really a "screenshot".



        $ script
        Script started, file is typescript
        $ ls asdf
        ls: cannot access asdf: No such file or directory
        $ exit
        Script done, file is typescript

        # Then check the recordings:

        $ cat typescript
        Script started on Thu 29 Nov 2018 02:52:04 PM CET

        $ ls asdf
        ls: cannot access asf: No such file or directory
        $ exit

        Script done on Thu 29 Nov 2018 02:52:09 PM CET






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 29 '18 at 13:53









        RolfRolf

        5151510




        5151510






























            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%2f483894%2fexisting-command-line-text-on-screen-to-file-non-graphical-linux%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

            To store a contact into the json file from server.js file using a class in NodeJS

            Redirect URL with Chrome Remote Debugging Android Devices

            Dieringhausen