Skip to main content

Install rsync for transferring files

Updated over a month ago

Use any one of the following commands to install rsync.

For Debian or Ubuntu Linux:

sudo apt install rsync

For AlmaLinux or Rocky Linux:

sudo dnf install rsync

Check if rsync is installed:

rsync --version

Example of commands

File synchronization (copies all files from the source directory to the destination):

rsync -av /source/directory/ /destination/directory/

File synchronization over SSH:

rsync -avz -e ssh /source/directory/ user@remote:/destination/directory/

Syncing files between local and remote systems:

rsync -avz /local/directory/ user@remote:/destination/directory/

Since rsync does not provide any security while transferring data, it is recommended that you use rsync over an SSH session. This allows a secure remote connection.

Copy a file from a remote server to a local computer:

rsync -v -e ssh [email protected]:~/file.html /tmp

Synchronize a local directory with a remote directory:

rsync -r -a -v -e "ssh -l root" --delete /local/folder server.server.tld:/folder

Synchronize a remote directory with a local directory:

rsync -r -a -v -e "ssh -l root" --delete server.server.tld:/folder/ /local/folder

Synchronize a local directory with a remote rsync server or vice versa:

rsync -r -a -v --delete rsync://sync.server.server.tld/folder /home/folder

Did this answer your question?