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.
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] 삭제
몇 마디 만하겠습니다