tar over SSH (part 2)
Apr 26, 2007
In our last episode we used tar to move a file structure across the network. This time, to create a tarball directly onto another machine the following command can be used:
tar czf - foo/ | ssh user@host "cat > /path/to/foo.tgz"
This is useful if the machine you’re taring from doesn’t have enough disk space to hold the tarball. Furthermore, it’s probably faster because the tarball is only being written once, directly to its final location.