4 ms·
It means that whatever you put into the ssh process's STDIN gets sent to the STDIN of the remote process. For example you can do this: tar cj $bigdir | ssh
by arnsholt 13y ago
It means that whatever you put into the ssh process's STDIN gets sent to the STDIN of the remote process. For example you can do this:
tar cj $bigdir | ssh host 'tar xj'
That creates a tar.bz2 archive on your machine, sends it over ssh to the remote host, where it's unpacked. Ad hoc compressed and encrypted file transfers made easy.
- mturmon 13y agoThat's a good illustration, but rsync, if available, would generally be preferred for that use case: rsync -az $bigdir host:$bigdir
- jfb 13y agoSure, of course. But I've used that tar|ssh combination so much that it was the first example of using the rsh-like stdout/in pairing that came to mind. As much as I bitch about Unix and POSIX and horrific shell brain damage, I still reach for crazy shell pipelines when I have data manipulation tasks up to some pretty large scale n.