0% found this document useful (0 votes)
19 views1 page

Backing Up With Rsync

The document provides instructions on using the rsync command for synchronizing directories in Bash and Z Shell. It highlights options such as -a for archiving, -n for dry-run, and --delete for removing files in the backup that are not present in the original directory. Rsync efficiently copies only the missing files, making it a powerful tool for backups.

Uploaded by

akym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views1 page

Backing Up With Rsync

The document provides instructions on using the rsync command for synchronizing directories in Bash and Z Shell. It highlights options such as -a for archiving, -n for dry-run, and --delete for removing files in the backup that are not present in the original directory. Rsync efficiently copies only the missing files, making it a powerful tool for backups.

Uploaded by

akym
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

"Managing Files Using Bash and Z Shell" course by Mateo Prigl at Pluralsight

Backing Up with Rsync


If you need to keep two directories synchronized, you can use the rsync
command. It works just like cp but it has more options.
You also need to add r when you want to sync directories. If you end the
directory name with slash, only the contents will be copied over, not the
directory itself.
Use the a option to copy files and directories and also keep their modification
time and other details.

$ rsync -a original_dir/ backup/

rsync will synchronize files incrementaly. That means that it will not copy all of
the files if it doesn't have to. It will copy only those files that are missing from
the target directory.
You can use the n dry-run option to prevent the synchronization so that you
can see which files the rsync plans to copy.
Use this option with the v verbose option, which will print out what the
command is doing in the background.
There is also a --delete option you can add. rsync will then delte all of the files
in the backup directory which don't exist in the directory you are trying to back
up (the one from the first argument).

1/1 © Copyright 2020 by Pluralsight

You might also like