Friday, August 25, 2006

tar and ssh like peanut butter and jelly

Everybody knows the classic command to make a tar file:

tar -cvf file.tar directory_to_tar

and if you use gnu tar you can improve it with the compress in that step:

tar -zxvf file.tar directory_to_tar
or
tar -jxvf file.tar directory_to_tar

for gzip and bzip respectively...

but did you know:

tar zcvf - /directory_to_tar | ssh hostname "cat > file.tgz"

so you can tar gzip on one end and write the file on the other end of an ssh session?

Huh? Did you?

Yes I know I still owe an automounter deal... I promise it is on the way.

Too busy gardening the Silicon Rust...

No comments: