KD0YTE's Ham Radio, Linux, and other stuff.

Entries from May 2025.

rsync commands
14th May 2025

rsync is a useful tool for copying files to a remote machine using ssh.
simple command to backup a directory is
rsync -a ~/dir1 username@remote_host:destination_directory
if the username is the same on both systems you can omit the username@
if you omit the destination after the : then files are copied to the users home folder.

comand line options
-a archive mode which preserves file permissions
-z will compress the file during transfer to make the transfer faster
-P will show progress and also allows partial transfer so that files that havent been changed won't have to be transferred again.
-an --delete forces rsync to delete the files on the destination before copying the source file. this is not the default behavior of rsync
-v is for verbose output giving information about the transfer as it is happening.
-h gives human readable output on files sizes etc.

Give rsync a try it is quite useful

Tags: linux.

RSS Feed