Copying blocks of text in terminal











up vote
16
down vote

favorite
2












Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?



Example:



enter image description here



Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?










share|improve this question









New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • How did you generate the entire block of text? In other words, what command did you use to get that info?
    – Allan
    17 hours ago















up vote
16
down vote

favorite
2












Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?



Example:



enter image description here



Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?










share|improve this question









New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • How did you generate the entire block of text? In other words, what command did you use to get that info?
    – Allan
    17 hours ago













up vote
16
down vote

favorite
2









up vote
16
down vote

favorite
2






2





Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?



Example:



enter image description here



Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?










share|improve this question









New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











Is it possible to copy a "block" of text from a terminal window without having to copy entire lines?



Example:



enter image description here



Say I just wanna copy the text I’ve circled in the image above, is this possible? Or do I also have to copy everything to the left of the block I want to copy?







macos terminal copy-paste






share|improve this question









New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited 24 mins ago









Monomeeth

45.1k795137




45.1k795137






New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked 17 hours ago









Mended

813




813




New contributor




Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Mended is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • How did you generate the entire block of text? In other words, what command did you use to get that info?
    – Allan
    17 hours ago


















  • How did you generate the entire block of text? In other words, what command did you use to get that info?
    – Allan
    17 hours ago
















How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago




How did you generate the entire block of text? In other words, what command did you use to get that info?
– Allan
17 hours ago










3 Answers
3






active

oldest

votes

















up vote
19
down vote













You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.



See screenshot below:



enter image description here



If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.






share|improve this answer



















  • 2




    This doesn't work in iTerm but works fine in Terminal.
    – jmh
    13 hours ago










  • @jmh See my answer.
    – Konrad Rudolph
    9 hours ago










  • @KonradRudolph ok, thanks...
    – jmh
    8 hours ago


















up vote
6
down vote













You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy






share|improve this answer





















  • Or just cut -c 56- or so.
    – Wildcard
    1 hour ago


















up vote
5
down vote













When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.



Or you can use copy mode:





  • Cmd+Shift+C to enter copy mode


  • Ctrl+v to enter vertical/block mode

  • Move the cursor using the cursor keys on the keyboard (see link for more movement options)

  • Once you’re done, use Ctrl+k, y to copy the selection.






share|improve this answer





















    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "118"
    };
    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',
    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
    });


    }
    });






    Mended is a new contributor. Be nice, and check out our Code of Conduct.










    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f345611%2fcopying-blocks-of-text-in-terminal%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








    up vote
    19
    down vote













    You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.



    See screenshot below:



    enter image description here



    If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.






    share|improve this answer



















    • 2




      This doesn't work in iTerm but works fine in Terminal.
      – jmh
      13 hours ago










    • @jmh See my answer.
      – Konrad Rudolph
      9 hours ago










    • @KonradRudolph ok, thanks...
      – jmh
      8 hours ago















    up vote
    19
    down vote













    You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.



    See screenshot below:



    enter image description here



    If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.






    share|improve this answer



















    • 2




      This doesn't work in iTerm but works fine in Terminal.
      – jmh
      13 hours ago










    • @jmh See my answer.
      – Konrad Rudolph
      9 hours ago










    • @KonradRudolph ok, thanks...
      – jmh
      8 hours ago













    up vote
    19
    down vote










    up vote
    19
    down vote









    You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.



    See screenshot below:



    enter image description here



    If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.






    share|improve this answer














    You should be able to do this by holding the option key down while doing it. This changes the cursor to a '+' sign and allows you to select any rectangular area of text.



    See screenshot below:



    enter image description here



    If you look at the above image closely, you'll see in the left window I've highlighted a block of text in Terminal and in the right window I've been able to paste this text into a new TextEdit document.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited 17 hours ago

























    answered 17 hours ago









    Monomeeth

    45.1k795137




    45.1k795137








    • 2




      This doesn't work in iTerm but works fine in Terminal.
      – jmh
      13 hours ago










    • @jmh See my answer.
      – Konrad Rudolph
      9 hours ago










    • @KonradRudolph ok, thanks...
      – jmh
      8 hours ago














    • 2




      This doesn't work in iTerm but works fine in Terminal.
      – jmh
      13 hours ago










    • @jmh See my answer.
      – Konrad Rudolph
      9 hours ago










    • @KonradRudolph ok, thanks...
      – jmh
      8 hours ago








    2




    2




    This doesn't work in iTerm but works fine in Terminal.
    – jmh
    13 hours ago




    This doesn't work in iTerm but works fine in Terminal.
    – jmh
    13 hours ago












    @jmh See my answer.
    – Konrad Rudolph
    9 hours ago




    @jmh See my answer.
    – Konrad Rudolph
    9 hours ago












    @KonradRudolph ok, thanks...
    – jmh
    8 hours ago




    @KonradRudolph ok, thanks...
    – jmh
    8 hours ago












    up vote
    6
    down vote













    You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy






    share|improve this answer





















    • Or just cut -c 56- or so.
      – Wildcard
      1 hour ago















    up vote
    6
    down vote













    You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy






    share|improve this answer





















    • Or just cut -c 56- or so.
      – Wildcard
      1 hour ago













    up vote
    6
    down vote










    up vote
    6
    down vote









    You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy






    share|improve this answer












    You might also try using awk to limit the shell output to what you want. You could then even pipe it to pbcopy







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 14 hours ago









    Vinnie James

    1765




    1765












    • Or just cut -c 56- or so.
      – Wildcard
      1 hour ago


















    • Or just cut -c 56- or so.
      – Wildcard
      1 hour ago
















    Or just cut -c 56- or so.
    – Wildcard
    1 hour ago




    Or just cut -c 56- or so.
    – Wildcard
    1 hour ago










    up vote
    5
    down vote













    When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.



    Or you can use copy mode:





    • Cmd+Shift+C to enter copy mode


    • Ctrl+v to enter vertical/block mode

    • Move the cursor using the cursor keys on the keyboard (see link for more movement options)

    • Once you’re done, use Ctrl+k, y to copy the selection.






    share|improve this answer

























      up vote
      5
      down vote













      When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.



      Or you can use copy mode:





      • Cmd+Shift+C to enter copy mode


      • Ctrl+v to enter vertical/block mode

      • Move the cursor using the cursor keys on the keyboard (see link for more movement options)

      • Once you’re done, use Ctrl+k, y to copy the selection.






      share|improve this answer























        up vote
        5
        down vote










        up vote
        5
        down vote









        When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.



        Or you can use copy mode:





        • Cmd+Shift+C to enter copy mode


        • Ctrl+v to enter vertical/block mode

        • Move the cursor using the cursor keys on the keyboard (see link for more movement options)

        • Once you’re done, use Ctrl+k, y to copy the selection.






        share|improve this answer












        When using iTerm2, you can either use Cmd+Option+mouse to perform vertical/block selection, which transforms your cursor into a cross, similar to Terminal.app.



        Or you can use copy mode:





        • Cmd+Shift+C to enter copy mode


        • Ctrl+v to enter vertical/block mode

        • Move the cursor using the cursor keys on the keyboard (see link for more movement options)

        • Once you’re done, use Ctrl+k, y to copy the selection.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered 9 hours ago









        Konrad Rudolph

        1,16221026




        1,16221026






















            Mended is a new contributor. Be nice, and check out our Code of Conduct.










            draft saved

            draft discarded


















            Mended is a new contributor. Be nice, and check out our Code of Conduct.













            Mended is a new contributor. Be nice, and check out our Code of Conduct.












            Mended is a new contributor. Be nice, and check out our Code of Conduct.
















            Thanks for contributing an answer to Ask Different!


            • 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.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • 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%2fapple.stackexchange.com%2fquestions%2f345611%2fcopying-blocks-of-text-in-terminal%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Plaza Victoria

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

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