rsync
From Peyton Hall Documentation
(Difference between revisions)
(New page: {{oldfaq|NUM=93}} Need to synchronize files between two places quickly? Use rsync. Also good for copying files from one location to another. rsync -avue ssh source_machine:/dir dest Th...) |
Current revision (20:33, 21 May 2007) (view source) m |
||
(3 intermediate revisions not shown.) | |||
Line 1: | Line 1: | ||
- | + | rsync is a program that can synchronize files between two locations. It can be used to sync files on local disks, NFS mounted disks, or even over the network via SSH. It is quite powerful in its ability to scan two file trees and copy over only what is necessary to make them equal. | |
- | |||
- | + | == Basic usage == | |
+ | <tt>rsync -avue ssh source_machine:/dir dest</tt> | ||
+ | : This will synchronize all the files from "source_machine"'s "<tt>/dir</tt>" directory to the local directory "<tt>dest</tt>". Note that this is one way, so if you want to sync files in both directions, you have to repeat the command, swapping the order of source and destination. The '<tt>-e</tt>' option, and corresponding '<tt>ssh</tt>', tells rsync to use ssh to do the transfer. | ||
- | + | '''NOTE:''' | |
+ | : The presence or absence of a trailing slash on the directories ''does'' make a difference! | ||
- | + | <tt>rsync -avue ssh coma:/u/user/WWW .</tt> | |
+ | : Create a directory in the current directory named WWW, and copy the contents of the remote dir to the source. It's like copying /u/user/WWW to the current directory. | ||
- | + | <tt>rsync -avue ssh coma:/u/user/WWW/ .</tt> | |
+ | : Copy the '''''contents''''' of /u/user/WWW to the current directory, and not the directory itself! This is important if you're trying to synchronize two file systems that started as a copy of each other, but are now slightly different, as you want to make sure the source and destination are the same as they were in the original copy. | ||
- | |||
- | rsync | + | == Documentation == |
+ | '[[man pages|man]] rsync' for more (lots more) details. Also have a look at the rsync homepage, http://rsync.samba.org, especially if you're looking for a binary compiled version to run on a remote machine. Last, there's a rsync tutorial at http://everythinglinux.org/rsync/ which is very informative. | ||
- | + | [[Category:Unix Commands]] | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + |
Current revision
rsync is a program that can synchronize files between two locations. It can be used to sync files on local disks, NFS mounted disks, or even over the network via SSH. It is quite powerful in its ability to scan two file trees and copy over only what is necessary to make them equal.
Basic usage
rsync -avue ssh source_machine:/dir dest
- This will synchronize all the files from "source_machine"'s "/dir" directory to the local directory "dest". Note that this is one way, so if you want to sync files in both directions, you have to repeat the command, swapping the order of source and destination. The '-e' option, and corresponding 'ssh', tells rsync to use ssh to do the transfer.
NOTE:
- The presence or absence of a trailing slash on the directories does make a difference!
rsync -avue ssh coma:/u/user/WWW .
- Create a directory in the current directory named WWW, and copy the contents of the remote dir to the source. It's like copying /u/user/WWW to the current directory.
rsync -avue ssh coma:/u/user/WWW/ .
- Copy the contents of /u/user/WWW to the current directory, and not the directory itself! This is important if you're trying to synchronize two file systems that started as a copy of each other, but are now slightly different, as you want to make sure the source and destination are the same as they were in the original copy.
Documentation
'man rsync' for more (lots more) details. Also have a look at the rsync homepage, http://rsync.samba.org, especially if you're looking for a binary compiled version to run on a remote machine. Last, there's a rsync tutorial at http://everythinglinux.org/rsync/ which is very informative.