Backup across the network

For taking backup across the network, we will need to install the ssh protocol package. Normally, it will already be installed. If it is not installed, then use the following command:

For CentOS or Red Hat

    # sudo yum install ssh

For Debian or Ubuntu:

    # sudo apt-get install ssh

The command to synchronize data from across the network to your local folder will be as follows:

    $ rsync -avzP --delete -e ssh user@ip_address:source-folder /destination-folder

Look at the following example:

    $ rsync -avzP --delete -e ssh student@ /home/student/data-folder /home/student/data-folder 

If we want to synchronize local folders to a remote computer, then the command would be as follows:

    $ rsync -avzP --delete ...

Get Learning Linux Shell Scripting - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.