rsync

This is kind of my cheat sheet, nothing fancy, just what I need.

Command:

rsync -chavzP --stats 'host:~/RemotePath' ./LocalPath

rsync – Befehl
-c, –checksum
-h, –human-readable
-a, –archive
-v, –verbose
-z, –compress
-P – equivalent to –partial –progress
–stats – This tells rsync to print a verbose set of statistics on the file transfer
‘host:~/RemotePath’ – is the source path (in this case a remote path.
./LocalPath – ist the destination

Some more variants:

from local to remote

rsync -chavzP --stats ~/FileName.file 'host:~/path/'

Leave the z if compression does not matter (in most cases it does not matter).

rsync -chavP --stats ~/FileName.file 'host:~/path/'

Rsync to MOVE a folder from A to B. Source will be deleted!!

rsync -hcavP --stats --remove-source-files ./source ./destination_folder

Rsync can be used from local to local to copy files. It can be used from ‘remote’ to local or vom local to ‘remote’, unfortunately it can not copy from remote to remote.

Don’t forget to include the ticks around the remote (host) part.

I this “rsync -chavzP –stats ~/FileName.file ‘host:~/path/'” the “host” is defined in my ~/.ssh/config, but you can also do something like this:
“rsync -chavzP –stats ~/FileName.file ‘user@example.org:~/path/'”

This even work via ssh jump hosts. I will write something about that soon.