How to copy file contents to the local clipboard from a file in a remote machine over sshCopy the contents of...

Why was "leaping into the river" a valid trial outcome to prove one's innocence?

How to stabilise the bicycle seat when it is all the way up

Are there any space probes or landers which regained communication after being lost?

Can a magnet rip protons from a nucleus?

Gas pipes - why does gas burn "outwards?"

Why do sellers care about down payments?

Is English tonal for some words, like "permit"?

Seized engine due to being run without oil

Writing a worded mathematical expression

I changed a word from a source, how do I cite it correctly?

Can I say "I have encrypted something" if I hash something?

Is it appropriate for a professor to require students to sign a non-disclosure agreement before being taught?

My favorite color is blue what is your favorite color?

Can I disable a battery powered device by reversing half of its batteries?

How do I politely hint customers to leave my store, without pretending to need leave store myself?

Open source GIS web server

How can a PC determine what planes a Cubic Gate is linked to?

Creating a Master Image to roll out to 30 new Machines Licensing Issues

Which ping implementation is Cygwin using?

How can I protect myself in case of a human attack like the murders of the hikers Jespersen and Ueland in Morocco?

Why would "an mule" be used instead of "a mule"?

Is it possible to PIVOT on a LIKE statement

Why does F + F' = 1?

The Royal Mint of Alphagonia



How to copy file contents to the local clipboard from a file in a remote machine over ssh


Copy the contents of a file into the clipboard without displaying its contentsCopy a file from a nautilus-script to clipboardCopy input to clipboard over SSH?How can I copy/paste data to and from the Windows clipboard to an OpenSuse clipboard using VNC?Copy / paste text selections between tmux and the clipboardDownload a file from a remote machine while SSH'd into it?How to copy contents of a (large) vim file to the OSX system clipboard to paste in other apps?Copy file to clipboard from consoleIs there any way to copy file's content in clipboard without opening the file?How to make a file with content from the clipboard without opening the file?Copy text in remote tmux/irrsi to local machine






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







17















To solve this problem I always have to use scp or rsync to copy the file into my local computer to open the file and simply copy the contents of the text file into my local clipboard. I was just wondering if there is a more clever way to do this without having the need of copying the file.










share|improve this question



























  • I changed the title a bit, because I kept the reading "the local clipboard of a file" and wondering since when files had clipboards.

    – Anthon
    Jun 18 '15 at 17:48











  • Thats fine thanks @Anthon English is not my first language so sometimes I need some help with it thanks.

    – VaTo
    Jun 18 '15 at 17:55


















17















To solve this problem I always have to use scp or rsync to copy the file into my local computer to open the file and simply copy the contents of the text file into my local clipboard. I was just wondering if there is a more clever way to do this without having the need of copying the file.










share|improve this question



























  • I changed the title a bit, because I kept the reading "the local clipboard of a file" and wondering since when files had clipboards.

    – Anthon
    Jun 18 '15 at 17:48











  • Thats fine thanks @Anthon English is not my first language so sometimes I need some help with it thanks.

    – VaTo
    Jun 18 '15 at 17:55














17












17








17


5






To solve this problem I always have to use scp or rsync to copy the file into my local computer to open the file and simply copy the contents of the text file into my local clipboard. I was just wondering if there is a more clever way to do this without having the need of copying the file.










share|improve this question
















To solve this problem I always have to use scp or rsync to copy the file into my local computer to open the file and simply copy the contents of the text file into my local clipboard. I was just wondering if there is a more clever way to do this without having the need of copying the file.







ssh clipboard






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 18 '15 at 21:44









Gilles

574k140 gold badges1184 silver badges1697 bronze badges




574k140 gold badges1184 silver badges1697 bronze badges










asked Jun 18 '15 at 17:26









VaToVaTo

1,9521 gold badge10 silver badges34 bronze badges




1,9521 gold badge10 silver badges34 bronze badges
















  • I changed the title a bit, because I kept the reading "the local clipboard of a file" and wondering since when files had clipboards.

    – Anthon
    Jun 18 '15 at 17:48











  • Thats fine thanks @Anthon English is not my first language so sometimes I need some help with it thanks.

    – VaTo
    Jun 18 '15 at 17:55



















  • I changed the title a bit, because I kept the reading "the local clipboard of a file" and wondering since when files had clipboards.

    – Anthon
    Jun 18 '15 at 17:48











  • Thats fine thanks @Anthon English is not my first language so sometimes I need some help with it thanks.

    – VaTo
    Jun 18 '15 at 17:55

















I changed the title a bit, because I kept the reading "the local clipboard of a file" and wondering since when files had clipboards.

– Anthon
Jun 18 '15 at 17:48





I changed the title a bit, because I kept the reading "the local clipboard of a file" and wondering since when files had clipboards.

– Anthon
Jun 18 '15 at 17:48













Thats fine thanks @Anthon English is not my first language so sometimes I need some help with it thanks.

– VaTo
Jun 18 '15 at 17:55





Thats fine thanks @Anthon English is not my first language so sometimes I need some help with it thanks.

– VaTo
Jun 18 '15 at 17:55










3 Answers
3






active

oldest

votes


















20
















Of course you have to read the file, but you could



ssh -e none USER@REMOTE "cat file" | xclip -i


though that still means to open a ssh connection and copy the contents of the file. But finally you don't see anything of it anymore ;)



And if you are connecting from an OS X computer you use pbcopy instead:



ssh -e none USER@REMOTE "cat file" | pbcopy





share|improve this answer




























  • This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

    – VaTo
    Jun 18 '15 at 17:50











  • -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

    – Stéphane Chazelas
    Aug 29 '17 at 10:02











  • thanks a lot!!!!!!

    – Alena Kastsiukavets
    Aug 15 at 5:55











  • you're welcome ;) That's what this platform is all about, isn't it?

    – ikrabbe
    Aug 15 at 16:32



















0
















Can I assume you are running the X Window System and some window manager (KDE/gnome/etc.)? There are a number of terminal applications (Konsole for example) that have a built in menu that allows copy/paste functions.
So you could:




  1. user@machine:~$ ssh root@172.x.x.x

  2. open the file on the remote machine

  3. highlight the contents of the file with mouse and select copy from the edit menu on your local machine.


Or did I misunderstand your real needs?






share|improve this answer























  • 3





    I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

    – VaTo
    Jun 18 '15 at 17:53











  • with big files, you can take more time on copy than rewrite the script manually in the local editor xD

    – Evhz
    Aug 16 '18 at 13:03











  • Lol. Is this answer even needed ?

    – bharath
    14 hours ago



















0
















Using Putty as your SSH client, ensure you max out lines of scrollback in your configuration. When you connect, you can clear screen and scrollback and then cat the file and when I right click on the title bar, I can select "copy all to clipboard". Then I can paste into an editor on my local machine.






share|improve this answer








New contributor



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
























    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/4.0/"u003ecc by-sa 4.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%2f210615%2fhow-to-copy-file-contents-to-the-local-clipboard-from-a-file-in-a-remote-machine%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









    20
















    Of course you have to read the file, but you could



    ssh -e none USER@REMOTE "cat file" | xclip -i


    though that still means to open a ssh connection and copy the contents of the file. But finally you don't see anything of it anymore ;)



    And if you are connecting from an OS X computer you use pbcopy instead:



    ssh -e none USER@REMOTE "cat file" | pbcopy





    share|improve this answer




























    • This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

      – VaTo
      Jun 18 '15 at 17:50











    • -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

      – Stéphane Chazelas
      Aug 29 '17 at 10:02











    • thanks a lot!!!!!!

      – Alena Kastsiukavets
      Aug 15 at 5:55











    • you're welcome ;) That's what this platform is all about, isn't it?

      – ikrabbe
      Aug 15 at 16:32
















    20
















    Of course you have to read the file, but you could



    ssh -e none USER@REMOTE "cat file" | xclip -i


    though that still means to open a ssh connection and copy the contents of the file. But finally you don't see anything of it anymore ;)



    And if you are connecting from an OS X computer you use pbcopy instead:



    ssh -e none USER@REMOTE "cat file" | pbcopy





    share|improve this answer




























    • This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

      – VaTo
      Jun 18 '15 at 17:50











    • -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

      – Stéphane Chazelas
      Aug 29 '17 at 10:02











    • thanks a lot!!!!!!

      – Alena Kastsiukavets
      Aug 15 at 5:55











    • you're welcome ;) That's what this platform is all about, isn't it?

      – ikrabbe
      Aug 15 at 16:32














    20














    20










    20









    Of course you have to read the file, but you could



    ssh -e none USER@REMOTE "cat file" | xclip -i


    though that still means to open a ssh connection and copy the contents of the file. But finally you don't see anything of it anymore ;)



    And if you are connecting from an OS X computer you use pbcopy instead:



    ssh -e none USER@REMOTE "cat file" | pbcopy





    share|improve this answer















    Of course you have to read the file, but you could



    ssh -e none USER@REMOTE "cat file" | xclip -i


    though that still means to open a ssh connection and copy the contents of the file. But finally you don't see anything of it anymore ;)



    And if you are connecting from an OS X computer you use pbcopy instead:



    ssh -e none USER@REMOTE "cat file" | pbcopy






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Aug 29 '17 at 9:44

























    answered Jun 18 '15 at 17:45









    ikrabbeikrabbe

    1,6754 silver badges17 bronze badges




    1,6754 silver badges17 bronze badges
















    • This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

      – VaTo
      Jun 18 '15 at 17:50











    • -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

      – Stéphane Chazelas
      Aug 29 '17 at 10:02











    • thanks a lot!!!!!!

      – Alena Kastsiukavets
      Aug 15 at 5:55











    • you're welcome ;) That's what this platform is all about, isn't it?

      – ikrabbe
      Aug 15 at 16:32



















    • This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

      – VaTo
      Jun 18 '15 at 17:50











    • -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

      – Stéphane Chazelas
      Aug 29 '17 at 10:02











    • thanks a lot!!!!!!

      – Alena Kastsiukavets
      Aug 15 at 5:55











    • you're welcome ;) That's what this platform is all about, isn't it?

      – ikrabbe
      Aug 15 at 16:32

















    This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

    – VaTo
    Jun 18 '15 at 17:50





    This is great, I though this wasn't possible. Although I had to use pbcopy because I'm connecting from a mac computer to a CentOS box. I just had to change xclip to pbcopy and it worked. Pretty nice!

    – VaTo
    Jun 18 '15 at 17:50













    -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

    – Stéphane Chazelas
    Aug 29 '17 at 10:02





    -e none would only be need to prevent the special handling of ~ from the keyboard (not from the output of commands) in interactive sessions only. It's not needed here.

    – Stéphane Chazelas
    Aug 29 '17 at 10:02













    thanks a lot!!!!!!

    – Alena Kastsiukavets
    Aug 15 at 5:55





    thanks a lot!!!!!!

    – Alena Kastsiukavets
    Aug 15 at 5:55













    you're welcome ;) That's what this platform is all about, isn't it?

    – ikrabbe
    Aug 15 at 16:32





    you're welcome ;) That's what this platform is all about, isn't it?

    – ikrabbe
    Aug 15 at 16:32













    0
















    Can I assume you are running the X Window System and some window manager (KDE/gnome/etc.)? There are a number of terminal applications (Konsole for example) that have a built in menu that allows copy/paste functions.
    So you could:




    1. user@machine:~$ ssh root@172.x.x.x

    2. open the file on the remote machine

    3. highlight the contents of the file with mouse and select copy from the edit menu on your local machine.


    Or did I misunderstand your real needs?






    share|improve this answer























    • 3





      I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

      – VaTo
      Jun 18 '15 at 17:53











    • with big files, you can take more time on copy than rewrite the script manually in the local editor xD

      – Evhz
      Aug 16 '18 at 13:03











    • Lol. Is this answer even needed ?

      – bharath
      14 hours ago
















    0
















    Can I assume you are running the X Window System and some window manager (KDE/gnome/etc.)? There are a number of terminal applications (Konsole for example) that have a built in menu that allows copy/paste functions.
    So you could:




    1. user@machine:~$ ssh root@172.x.x.x

    2. open the file on the remote machine

    3. highlight the contents of the file with mouse and select copy from the edit menu on your local machine.


    Or did I misunderstand your real needs?






    share|improve this answer























    • 3





      I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

      – VaTo
      Jun 18 '15 at 17:53











    • with big files, you can take more time on copy than rewrite the script manually in the local editor xD

      – Evhz
      Aug 16 '18 at 13:03











    • Lol. Is this answer even needed ?

      – bharath
      14 hours ago














    0














    0










    0









    Can I assume you are running the X Window System and some window manager (KDE/gnome/etc.)? There are a number of terminal applications (Konsole for example) that have a built in menu that allows copy/paste functions.
    So you could:




    1. user@machine:~$ ssh root@172.x.x.x

    2. open the file on the remote machine

    3. highlight the contents of the file with mouse and select copy from the edit menu on your local machine.


    Or did I misunderstand your real needs?






    share|improve this answer















    Can I assume you are running the X Window System and some window manager (KDE/gnome/etc.)? There are a number of terminal applications (Konsole for example) that have a built in menu that allows copy/paste functions.
    So you could:




    1. user@machine:~$ ssh root@172.x.x.x

    2. open the file on the remote machine

    3. highlight the contents of the file with mouse and select copy from the edit menu on your local machine.


    Or did I misunderstand your real needs?







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jun 18 '15 at 17:47









    Anthon

    63.9k18 gold badges116 silver badges182 bronze badges




    63.9k18 gold badges116 silver badges182 bronze badges










    answered Jun 18 '15 at 17:44









    stephen muthstephen muth

    1366 bronze badges




    1366 bronze badges











    • 3





      I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

      – VaTo
      Jun 18 '15 at 17:53











    • with big files, you can take more time on copy than rewrite the script manually in the local editor xD

      – Evhz
      Aug 16 '18 at 13:03











    • Lol. Is this answer even needed ?

      – bharath
      14 hours ago














    • 3





      I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

      – VaTo
      Jun 18 '15 at 17:53











    • with big files, you can take more time on copy than rewrite the script manually in the local editor xD

      – Evhz
      Aug 16 '18 at 13:03











    • Lol. Is this answer even needed ?

      – bharath
      14 hours ago








    3




    3





    I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

    – VaTo
    Jun 18 '15 at 17:53





    I could do this with small files but with big files if I try to scroll up or down it goes off of the file (you can try it for yourself to see that this approach not always work.)

    – VaTo
    Jun 18 '15 at 17:53













    with big files, you can take more time on copy than rewrite the script manually in the local editor xD

    – Evhz
    Aug 16 '18 at 13:03





    with big files, you can take more time on copy than rewrite the script manually in the local editor xD

    – Evhz
    Aug 16 '18 at 13:03













    Lol. Is this answer even needed ?

    – bharath
    14 hours ago





    Lol. Is this answer even needed ?

    – bharath
    14 hours ago











    0
















    Using Putty as your SSH client, ensure you max out lines of scrollback in your configuration. When you connect, you can clear screen and scrollback and then cat the file and when I right click on the title bar, I can select "copy all to clipboard". Then I can paste into an editor on my local machine.






    share|improve this answer








    New contributor



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


























      0
















      Using Putty as your SSH client, ensure you max out lines of scrollback in your configuration. When you connect, you can clear screen and scrollback and then cat the file and when I right click on the title bar, I can select "copy all to clipboard". Then I can paste into an editor on my local machine.






      share|improve this answer








      New contributor



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
























        0














        0










        0









        Using Putty as your SSH client, ensure you max out lines of scrollback in your configuration. When you connect, you can clear screen and scrollback and then cat the file and when I right click on the title bar, I can select "copy all to clipboard". Then I can paste into an editor on my local machine.






        share|improve this answer








        New contributor



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









        Using Putty as your SSH client, ensure you max out lines of scrollback in your configuration. When you connect, you can clear screen and scrollback and then cat the file and when I right click on the title bar, I can select "copy all to clipboard". Then I can paste into an editor on my local machine.







        share|improve this answer








        New contributor



        Mike Pone 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 answer



        share|improve this answer






        New contributor



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








        answered 1 hour ago









        Mike PoneMike Pone

        1011 bronze badge




        1011 bronze badge




        New contributor



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




        New contributor




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




































            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%2f210615%2fhow-to-copy-file-contents-to-the-local-clipboard-from-a-file-in-a-remote-machine%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

            Hudson River Historic District Contents Geography History The district today Aesthetics Cultural...

            The number designs the writing. Feandra Aversely Definition: The act of ingrafting a sprig or shoot of one...

            Ayherre Geografie Demografie Externe links Navigatiemenu43° 23′ NB, 1° 15′ WL43° 23′ NB, 1°...