Re:A little SSH file copy magic at the command line
by johnisgood on Friday October 11, 2019 @01:35PM
(#21226562)
Note: you can do the opposite as well to achieve the same thing, e.g. listen on the "sending system", in which case when you connect, you get the file.
~~ Receiving system `# nc -l -p $arbitraryPort > /path/to/file `
~~ Sending system `# cat /path/to/file | nc $receivingSystemIP -p $arbitraryPort `
eg: `# nc -l -p 9669 > /home/user/staging/httpd.conf ` `# cat /etc/httpd/httpd.conf | nc 10.50.50.1 -p 9669 `
This method is a useful feather to have in one's cap when used in combination with tar and Pipeviewer `pv`.
I've used this several times doing a backup of a large database and when I don't have enough space locally to hold the copy.