[SWLUG] Network backups

Justin Mitchell justin at discordia.org.uk
Tue Sep 12 16:40:20 UTC 2006


On Tue, 2006-09-12 at 17:25 +0100, Glenn Booth wrote:

> 
>         You may find tar to be simpler/easier in this instance e.g.
>         
>         sudo tar -zcf - /home | ssh user at remote_host "cat >
>         backup.tar.gz"
> 
> I thought this was an interesting idea, and (with a couple of tweaks)
> it works a 
> treat! It's learning stuff like this that makes me love Linux.
> However, it raises 
> a couple of questions for me. 
> 
> First, what on earth does the " - " mean in the tar command "tar -zcf
> - /home..." (the second hyphen). The tar 'info' and 'man' pages didn't
> show me anything, and Googling for "tar -" isn't very productive.

in this case it means output to stdout, so you can pipe the output into
a different program.


> Second (and this shows my lack of understanding) how would I restore a
> tar file created this way? i.e. can it be used in reverse?
its just created a normal format tar file, just somewhere else.

you could restore directly from the other end doing something like:

ssh user at remote_host cat file.tgz  | tar zxf -


in this case your asking the remote end to just cat the file out to
stdout, the stdout of the ssh command is then going into tar, which has
been told its input file is stdin (the - again)






More information about the Swlug mailing list