Tag-Archive for » copy «

Samedi, septembre 27th, 2008 | Author: admin

Useful file copy snippets collection for systems administration. scp is not here : syntax is trivial, and scp is really slow. The snippets below are supposed to be much faster, especially when dealing with many small files.

netcat style

  • On sender :

cd to the top dir to be copied recursively, and :
tar cv . | nc -vq 10 -l -p 1234

  • On receiver :

cd to the dir where the content has to be copied, and :
nc -v sender 1234 | tar xf -

ssh style

  • Data is remote, copy to where I am now :

ssh user@source "cd /source/dir; tar cv ." | tar x

  • Data is in current directory, copy to remote server :

tar cv . | ssh user@destination "cd /dest/dir; tar x"

rsync+ssh style

  • Data is in current directory, copy to remote server :

rsync -ve ssh -ar . user@destination:/dest/dir/

Note : add ‘z’ to tar options if link is slow

Category: sysadmin  | Tags: , , , , , ,  | Leave a Comment