Linux – How To Use rsync Command To Backup Directory

rsync command easily backup your home directory to local secondary hard disk or remote server using ssh protocol.

rsync is a software application for Unix systems which synchronizes files and directories from one location to another while minimizing data transfer using delta encoding when appropriate.

Example: Backup /home/user to /mnt/usbpen

Assuming that USB pen or external USB hard disk is mounted at /mnt/usbpen, enter the following command to backup (sync) new files and changes to existing files but don’t remove files in backup directory:

$ rsync -au /home/tom /mnt/usbpen

To delete files in backup directory that no longer exist in directory being backed up, enter:

$ rsync -au --delete /home/user /mnt/usbpen

Leave a Reply

Your email address will not be published. Required fields are marked *