- Internal pipe-lining decreases latency for multiple files.
- rsync is used to update file systems and directory trees.
- For data transmission, it uses direct sockets, rsh, or ssh.
- It also can support the anonymous rsync, which is perfect for mirroring.
- Its installation on Linux does not require any special privileges.
- rsync also maintains the file ownership, modification time, devices, hard links, and symbolic links.
What is rsync –dry-run?
“–dry-run” option allows the rsync command to run a trial without making any changes—most of the time, this process the same output as the real execution. The rsync command is combined with various options to specify what the rsync command will do before someone can execute it.
However, the “–itemize-changes” should also behave the same as a dry run. There must be a bug if both outputs are not the same.
Since a dry run does not sync the actual data for transferring files, the “–progress” operation has no influence. Thus, the bytes received and sent, matched data, and literal data statistics are minimal. Moreover, the “speedup” value equals an actual run where no file transfers were required.
Using rsync –dry-run:
rsync –dry-run with “–delete” option:
Utilize the rsync –dry-run to delete files while running the trial. Here is the syntax of this form of rsync command:
The below-given command is based on the standard rsync syntax for performing a dry run combined with file deletion.
It was a dry run, but you will get a similar output while doing actual file synchronization. The terminal displayed “DRY RUN” at the bottom of the window to ensure that only the dry run was not the actual one.
rsync –dry-run with “–chown” command:
In the rsync command, you can also set the ownership and group of the destination directories by using the “–chown” option while performing the dry run. Check out the below-given syntax of the rsync command:
Specify the “user,” “group,” and the “remote_host,” and start the dry run.
rsync –dry-run with “head” and “tail” commands:
You can also redirect the output of the rsync –dry-run command to any file by using the “>” operator. Furthermore, utilize the head and tail command to select a specific part of the dry run output to be stored. Have a look at the syntax of this rsync command:
We will execute the below-given command, and all of the filtered dry run output will be stored in the “include.txt” file.
At the end of this procedure, execute the “cat” command to verify the content of the “include.txt” file.
In Linux-based systems, rsync exists as a free software utility. We can use it to sync directories and files from remote to the local system, local to a remote system, or at the same system. When you combine the rsync command with the “–dry-run” option, this utility runs a trial without making any changes. In this post, we have seen three different of the rsync –dry-run command execution.