linux - Elegantly send local tarball and untar on remote end -


all,

this might faq, can't search-fu find it. namely, kind of want "reverse" tar pipe. tar pipe used send local folder remote location tar ball in single nice command:

tar zcvf - ~/myfolder | ssh user@remote "cat > ~/backup/myfolder.tar.gz" 

(i hope got right. typed memory.)

i'm wondering reverse situation. let's locally have tarball of large directory , want copy (rsync? scp?) remote machine live expanded file, i.e.,:

local:  sourcecode.tar.gz ==> send remote , untar ==> remote: sourcecode/ 

i want because "local" disk has inode pressure keeping single bigger file better many smaller files. remote system 1 negligible inode pressure, , preferable keep expanded directory.

now, can think of various ways &&-command chaining , like, figure there must way tar-pipes , rsync or ssh/scp not seeing.

you're of way there:

ssh user@remote "tar -c /parent/directory -xz -f-" < sourcecode.tar.gz 

where -f- tells tar extract stdin, , -c flag changes directory before untarring.


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -