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@192.168.10.55: /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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.