Linux Rsync Command


“With the help of the freeware command-line utility known as Rsync, sometimes known as Remote Sync, you may send files and folders to both local and distant locations. Data migration to different servers, archiving, and replication are all possible using Rsync. With possibilities for customization, this utility is quick and effective, replicating just the modifications from the origin. Within this guide today, we will be covering some examples to discuss the use of the rsync command to move files and folders locally as well as remotely.”

Install Rsync Utility

Before going to the implementation, we wish to make certain that the “rsync” software is already put in and able to be used. Thus, we’ve been the usage of the “apt” set up instruction on the console utility question space. The execution of this instruction asks for the lately logged-in person account password. After this, the device will set up the rsync software in a couple of moments. The output presentations that the rsync software is already put in in our device and able to be used.

Before the usage of the rsync question within the shell, we can check out its lend a hand information by means of the “—help” choice within the question space. The “help” information can allow us to see its put in model, together with its functions discussed within the output as offered within the symbol.

Scroll just a little down in its proven output, and you’re going to be offered by means of the rsync software. It presentations the syntax for use for this instruction at the shell and explains all of its choices within the “Options” phase as in step with the output beneath.

Copy Single File Locally

Let’s say you have got a record named “” inside the present operating listing of your device, i.e., the house listing. We have attempted the “ls” instruction to record down all of the information and folders of our Linux device’s present listing and were given the shown-below output, i.e., the record may be indexed.

We have attempted the rsync instruction with the sudo rights and “-a” solution to replica the record “” from the present operating listing (house/saeedraza) to the “/tmp” folder of our Linux device in an archive structure. The command doesn’t output anything else. So, we’ve attempted the “cd” instruction together with the trail “/tmp” to transport inside the “tmp” folder and attempted the “ls” record instruction to show the knowledge of the “tmp” folder. It displayed that the record has been effectively moved from one folder to any other folder operating in the neighborhood.

So, we’ve attempted the exact same instruction to transport the record within the “tmp” folder with a brand new title, “”. After transferring to the “tmp” folder with the “cd” instruction and list the contents of the “tmp” folder, we will be able to see that the folder has a brand new record “,” i.e., a record “”.

Copy Multiple Files Locally

We will likely be the usage of the rsync instruction to replicate more than one information from one native folder to any other. So, we’ve attempted the “ls” instruction to determine the present contents of a present operating listing. We discovered that it has two bash information, i.e., and Make certain to take away the previous copied information from the “tmp” folder to effectively replica more than one information in the similar folder.

Thus, we’ve attempted the similar rsync instruction with sudo rights and the “-v” choice for the verbose structure of information. After that, we’ve added the trail to each information to replicate each the information from the present operating listing “home” to the brand new folder “tmp”. It calls for the “sudo” password and effectively copied each the information within the vacation spot trail, i.e., “/tmp”. It displayed the selection of knowledge bytes delivered, gained, general measurement, and velocity of supply. After this, we attempted the “cd” instruction to transport inside the “tmp” folder and indexed its knowledge. Both the information are offered within the “tmp” folder of the program as in step with the yielded end result.

Copy a Directory Locally

We can transfer a complete listing from one major folder to any other. So, we’ve created a brand new listing named “move” inside of our present house folder by means of the “mkdir” instruction.

Now, we’ve been the usage of the rsync command remark in Ubuntu’s shell with the sudo rights and “-a” solution to make the archive of a “move” folder into the “/tmp” folder of our Ubuntu 20.04 device. For this, you want so as to add the trail to each the supply and vacation spot. The tmp folder has been appearing the “move” folder indexed in it.

We too can transfer the folder to its vacation spot folder with a brand new title as we did for information. So, we’ve attempted the similar rsync instruction and moved the “move” folder to the “tmp” folder with a brand new title, “new”. The “ls” instruction presentations the luck of the “rsync” command.

Copy a Directory With Sub-directories Locally

In this representation, you’re going to see using rsync to replicate the folder and its subfolders in the neighborhood. We have created a brand new folder, “test,” with the “mkdir” instruction.

Created 3 subfolders inside the newly created “test” folders.

Used the “rsync” instruction with the “-av” solution to transfer the “test” folder to a “new” folder. The output has been appearing that the “test” folder together with its subfolders are copied.

Moving inside the “new” folder, we’ve discovered that the rsync command used to be a success.

Copy a Directory Remotely

To transfer information from supply to vacation spot remotely, we’d like the ip deal with of a specific vacation spot. The below-shown command is copying the “new” folder to the opposite digital gadget with a selected ip deal with.

To replica a record from a far off gadget to an area gadget, you want to interchange the placement of paths within the rsync command as offered.


We have mentioned the set up and utilization of the rsync command in Ubuntu 20.04. After this, we’ve mentioned the rsync instruction utilization inside the command shell to replicate a record from one folder to any other in the neighborhood, replica more than one information, replica a folder together with its subfolders, and using rsync to replicate information from native to far off and take away to the native platform.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More