Rsync: Difference between revisions

From Psygen Wiki
Jump to navigation Jump to search
No edit summary
Line 5: Line 5:


<code> -a </code> - Combo flag, same as -rlptgoD (recursive; copies symlinks; preserve: permissions, modification times, group, and owner; device&#47;special)
<code> -a </code> - Combo flag, same as -rlptgoD (recursive; copies symlinks; preserve: permissions, modification times, group, and owner; device&#47;special)
<code> -v </code> - verbose
<code> -n </code> - do a "dry run". Together with -v, -n shows what rsync will copy, but doesn't actually copy anything


<code>dir</code> vs <code>dir&#47;</code>:<br />
<code>dir</code> vs <code>dir&#47;</code>:<br />
Line 13: Line 17:


<code>rsync -a dir1&#47; dir2</code> - Copies the contents of dir1 into dir2
<code>rsync -a dir1&#47; dir2</code> - Copies the contents of dir1 into dir2
== Copy files to a remote system ==
<code>rsync -a ~/dir1 username@remote_host:destination_directory</code> - Copies the entire specified directory to the destination on the server.
Example: <code>rsync - /docs bob@example.com:/home/bob/public_html</code>





Revision as of 19:11, 27 February 2017

rsync copies files and directories. It is often used for backups, or duplicating directory contents on a remote server. rsync can copy only changed files, and can use SSH to securely copy the file.

Common Options

-a - Combo flag, same as -rlptgoD (recursive; copies symlinks; preserve: permissions, modification times, group, and owner; device/special)

-v - verbose

-n - do a "dry run". Together with -v, -n shows what rsync will copy, but doesn't actually copy anything

dir vs dir/:
dir - Copy the directory
dir/ - Copy the contents of the directory

Sync Directories on the same computer

rsync -a dir1/ dir2 - Copies the contents of dir1 into dir2

Copy files to a remote system

rsync -a ~/dir1 username@remote_host:destination_directory - Copies the entire specified directory to the destination on the server.

Example: rsync - /docs bob@example.com:/home/bob/public_html


References

  1. rsync man page
  2. d