[H-GEN] What's wrong with this command?
Jason Parker-Burlingham
jasonp at panix.com
Sun Oct 1 21:27:36 EDT 2006
On 10/1/06, Ewan Edwards <Edwards_Ewan_B at cat.com> wrote:
> tar -czf - Jira/ | ssh root at diamond cat - > /misc/Jira.tgz
Yeah, this is writing a tar file, piping that to an ssh process which
logs into "diamond", and runs "cat -", which will read from its stdin
(which is the output from the tar process, more or less) and write it
to stdout, which comes back to your machine (since stdout is your
terminal, or close enough) and then writes it back to /misc/Jira.tgz
on the local machine. So, yes, that (presumably) huge tarfile
traverses the network twice before it gets written to a local disk.
Ouch.
echo foo | ssh A cat - | wc -w
1
For a moment or two I sat wondering why there was not a Unix utility
to write to a file, but remembered before hitting send that of course
there is, and it's called "dd":
tar -cvf - Jira | ssh root at diamond dd of=/misc/Jira.tgz
That should work, I think. You can even use the "bs", "obs", and
"ibs" settings for dd to fiddle with block sizes, though I've never
been clear on how well that worked in this situation.
jasonp
More information about the General
mailing list