Skip to Content
Linux Shell Scripting Cookbook - Third Edition
book

Linux Shell Scripting Cookbook - Third Edition

by Clif Flynt, Sarath Lakshman, Shantanu Tushar
May 2017
Beginner
552 pages
28h 47m
English
Packt Publishing
Content preview from Linux Shell Scripting Cookbook - Third Edition

How to do it...

  1. To copy a source directory to a destination, use the following command:
        $ rsync -av source_path destination_path

Consider this example:

        $ rsync -av /home/slynux/data 
        slynux@192.168.0.6:/home/backups/data

In the preceding command:

  • -a stands for archiving
  • -v (verbose) prints the details or progress on stdout

The preceding command will recursively copy all the files from the source path to the destination path. The source and destination paths can be either remote or local.

  1. To backup data to a remote server or host, use the following command:
        $ rsync -av source_dir username@host:PATH

To keep a mirror at the destination, run the same rsync command at regular intervals. It will copy only changed files to the destination. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Mastering Linux Shell Scripting - Second Edition

Mastering Linux Shell Scripting - Second Edition

Mokhtar Ebrahim, Andrew Mallett

Publisher Resources

ISBN: 9781785881985