//View Tip #78
» Because wireshark is big and nc is small.
» Bash function to decompress archives
» Moving large directories
» Finding Newer Files [OR How To Create A Patch File]
Steve
Similar Tips
» Permanent bash history» Because wireshark is big and nc is small.
» Bash function to decompress archives
» Moving large directories
» Finding Newer Files [OR How To Create A Patch File]
Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
You can use ssh in conjunction with tar to pull an entire directory tree from a remote machine into your current directory:
ssh <username@sourcehost> tar cf - -C <sourcedir> . | tar xvf -
For example, let's say you have a "bsmith" account on a host called "apple". You want to copy those files into your "bobsmith" account on a host called "pear". You'd log into your "bobsmith@pear" account and type the following:
ssh bsmith@apple tar cf - -C /home/bsmith . | tar xvf -
This technique is useful when you have insufficient disk space on the source machine to make an intermediate tarball.
ssh <username@sourcehost> tar cf - -C <sourcedir> . | tar xvf -
For example, let's say you have a "bsmith" account on a host called "apple". You want to copy those files into your "bobsmith" account on a host called "pear". You'd log into your "bobsmith@pear" account and type the following:
ssh bsmith@apple tar cf - -C /home/bsmith . | tar xvf -
This technique is useful when you have insufficient disk space on the source machine to make an intermediate tarball.
Comments
Add your comment
Comments are currently disabled
#1
rsync would be a better tool for this task, but this works great if you don't have rsync.
Posted 2009-02-21 20:10:32

