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

VaTo

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.

ikrabbe

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

</dev/null ssh 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:

</dev/null ssh USER@REMOTE "cat file" | pbcopy

PS: Instead of </dev/null you can use ssh -n but I don't like expressing things in terms of software options, where I can use the system to get the same.

PPS: The </dev/null pattern for ssh is extremely usefull for loops

printf %s\\n '-l user host1' '-l user host2' | while read c
do </dev/null ssh $u "ip address; hostname; id"
done

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

How to copy a file on remote machine using PySTAF

분류에서Dev

"No such file or directory" error when attempting to copy (using scp) from remote host to local machine

분류에서Dev

How to copy files from remote server to local machine?

분류에서Dev

Copy file from remote to local with Windows 10 Bash

분류에서Dev

How to copy entire folder and subfolder from remote sever to local machine using PuTTY psftp

분류에서Dev

How do I run a executable .sh file on a remote server from local in its remote-existed path?

분류에서Dev

How to copy contents of one text file to another with reduced length?

분류에서Dev

installing file on remote machine with GUI

분류에서Dev

Is there any way to copy file's content in clipboard without opening the file?

분류에서Dev

Direct stderr to a file over ssh

분류에서Dev

How do I SCP from remote machine to local machine when I am outside of my home network?

분류에서Dev

How to access a XML file from another machine

분류에서Dev

Copy files from remote Ubuntu to local Mac

분류에서Dev

How does one properly copy a file into multiple folders and subfolders without overwriting the file contents in the destination folders?

분류에서Dev

How to copy a file from URL to document folder?

분류에서Dev

How to connect to another machine over SSH?

분류에서Dev

How to delete files from a directory based on the contents of a gzipped tar file?

분류에서Dev

How can I recreate a list of list of floats from the contents of a file?

분류에서Dev

How do you copy files from a remote server to a local folder in emacs using dired/tramp?

분류에서Dev

Transfer a file over a unstable SSH connection

분류에서Dev

How do I set up SSH to transfer files from my local machine to a shared server with rsync?

분류에서Dev

what is the default speed in rsync to send from local to remote machine?

분류에서Dev

Search Git remote branches for commit where file contents were added?

분류에서Dev

How to copy text from command line to clipboard without using the mouse?

분류에서Dev

How to transfer a part of a file from remote system via SCP?

분류에서Dev

Running Pyplot over Putty ssh from windows machine to linux

분류에서Dev

clipboard between osx and linux over ssh

분류에서Dev

C program over-writing file contents in if statement

분류에서Dev

How to copy matches from an extremely large file if it contains no newlines?

Related 관련 기사

  1. 1

    How to copy a file on remote machine using PySTAF

  2. 2

    "No such file or directory" error when attempting to copy (using scp) from remote host to local machine

  3. 3

    How to copy files from remote server to local machine?

  4. 4

    Copy file from remote to local with Windows 10 Bash

  5. 5

    How to copy entire folder and subfolder from remote sever to local machine using PuTTY psftp

  6. 6

    How do I run a executable .sh file on a remote server from local in its remote-existed path?

  7. 7

    How to copy contents of one text file to another with reduced length?

  8. 8

    installing file on remote machine with GUI

  9. 9

    Is there any way to copy file's content in clipboard without opening the file?

  10. 10

    Direct stderr to a file over ssh

  11. 11

    How do I SCP from remote machine to local machine when I am outside of my home network?

  12. 12

    How to access a XML file from another machine

  13. 13

    Copy files from remote Ubuntu to local Mac

  14. 14

    How does one properly copy a file into multiple folders and subfolders without overwriting the file contents in the destination folders?

  15. 15

    How to copy a file from URL to document folder?

  16. 16

    How to connect to another machine over SSH?

  17. 17

    How to delete files from a directory based on the contents of a gzipped tar file?

  18. 18

    How can I recreate a list of list of floats from the contents of a file?

  19. 19

    How do you copy files from a remote server to a local folder in emacs using dired/tramp?

  20. 20

    Transfer a file over a unstable SSH connection

  21. 21

    How do I set up SSH to transfer files from my local machine to a shared server with rsync?

  22. 22

    what is the default speed in rsync to send from local to remote machine?

  23. 23

    Search Git remote branches for commit where file contents were added?

  24. 24

    How to copy text from command line to clipboard without using the mouse?

  25. 25

    How to transfer a part of a file from remote system via SCP?

  26. 26

    Running Pyplot over Putty ssh from windows machine to linux

  27. 27

    clipboard between osx and linux over ssh

  28. 28

    C program over-writing file contents in if statement

  29. 29

    How to copy matches from an extremely large file if it contains no newlines?

뜨겁다태그

보관