On Fri, 27 Aug 2010, Chris Frederick wrote:

> I believe that would be:
>
> dd if=/dev/zero bs=1M count=1000 | ssh user at server dd of=/dev/null
>
> If you execute a command via ssh directly, it will receive any pipes 
> that were locally assigned to ssh.
>
> e.g.:
> ssh user at server echo 'hello world' > response.txt
> This creates a response.txt file on the local system in the current
> directory even though the command was executed on the remote server.
>
> ssh user at server 'echo "hello world" > response.txt'
> This creates a response.txt file on the remote server, notice that the
> entire command was enclosed in 's, including the the stdout redirection.
>
> cat bigfile|gzip|ssh user at server 'gunzip|tr a-z A-Z|gzip' >bigfile.gz
>
> This is a bit ridiculous, but you can start to see some uses for all 
> this.  Assuming you have good bandwidth to a faster machine, you could 
> offload some tasks to a remote server.  Of course if that were true, you 
> would probably be better off with netcat or /dev/tcp, as they don't have 
> the overhead of encrypting the stream, but you would have to trust the 
> network they are going over with your cleartext data.


My use for that kind of thing in the past has been to use tar to transfer 
directory trees.

I think this is what I was looking for:

dd if=/dev/zero bs=1M count=1000 | ssh user at server cat - > /dev/null

It is tricky to time it, though.  If I do this:

time dd if=/dev/zero bs=1M count=1000 | ssh user at server cat - > /dev/null

The time to enter the password gets counted in the "real" time.

Anyway, testing from office (at the U) to home (Qwest 40 Mbps, 
supposedly), it is *way* faster with -C than without.  It took about 50% 
longer to send 20 MB without -C than to send 200 MB (ten times the data) 
with -C.  So I can get up to 15x improvement with -C.

Mike