Rsync: Difference between revisions

From Leo's Notes
This page was last edited on 1 September 2019, at 06:21.
m Text replacement - "{{Navbox Linux}}{{Navbox Linux}}" to "{{Navbox Linux}}"
m Text replacement - "Category:Linux{{Navbox Linux}}" to "{{Navbox Linux}}Category:Linux"
Line 48: Line 48:




[[Category:Linux]]{{Navbox Linux}}
{{Navbox Linux}}[[Category:Linux]]
[[Category:LinuxUtilities]]
[[Category:LinuxUtilities]]
[[Category:Todo]]
[[Category:Todo]]

Revision as of 06:21, 1 September 2019


Quick Usage Guide

Copying Files via SSH

To copy files from /export/backup to a remote location (on server 'backup'):

# rsync -avz /export/backup/ -e ssh backup:/export/backup/

## Or with a non-standard SSH port
# rsync -avz /export/backup/ -e "ssh -p 2222 backup:/export/backup/"

Copying files with Progress Information

# rsync -avh --progress /src/ /dst/

Copying Directories

Because I've been bitten by this issue way too many times in the past couple of days, to avoid copying a directory into another directory, always have a trailing slash from the source.

In more depth, suppose I have a 'src' directory and I want its contents to be replicated in 'dst'.

## This copies 'src' into 'dst/src'
# rsync -avh src dst

## This too copies 'src' into 'dst/src'
# rsync -avh src dst/

## Works as expected. Contents in src is now in dst
# rsync -avh src/ dst

## Works as expected as well
# rsync -avh src/ dst/




See Also