rsync is a widely used utility for keeping copies of a file on two computer systems at the same time.
It is commonly found on Unix-like systems and in functions such as a file synchronization and file transfer program. The rsync algorithm, a type of delta encoding, is used to minimize network usage.
Zlib can be used for additional compression and SSH or stunnel can be used for data security.
Rsync is open source under the terms of the GNU GPL Version 2.
To install Rsync on your Distro, examples:
Now on to the examples!
Similar to cp command
That is, requiring details of the operation
The parameter is -r
or --recursive
, but now it’s good to use all commands with -v
The problem with example 03 is that the my-dir directory will not be created and the files will be scattered around.
The correct thing is to use it creating the directory:
output example:
Or specifying your username and also verbose:
Just as in scp you need to use -r
, for this remote case you don’t need --mkpath
, directories will be created automatically.
Output example:
We know that you can use *
to copy glob style, which is not regex. So to copy only the txt files from the remote root directory.
Remembering that the directory will not be created.
Unlike scp
, if you cancel the copy the local file will no longer exist, that is, it does not copy pieces, it is always synchronously.
Remote copying within the network also consumes bandwidth based on the speed of your network card, so in order for you to continue using the network or the internet without slowing it down, sometimes it is interesting to limit the speed of the copy, for this you can use the --bwlimit=[number]
parameter, where the [number] will be in kilobits .
The speed will not be exactly 64k, but it will be around, a little above or below, for example:
And finally, we are left with the manual and help, because there are still many parameters!