The syntax for rsync command to copy/sync files and directories

rsync options source destination


Some common options used with rsync commands


-v : –verbose – increase verbosity

-r : copies data recursively

-a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps

-z : compress file data

-h : human-readable output


  • Copy/Sync Files and Directory Locally

Copy/Sync file with name list.txt to /home/adminzz/client directory on the same machine

rsync -zvh /home/safei/client/list.txt /home/adminzz/client/


  • Copy/Sync a Directory on Local Computer

Copy/Sync backup directory for adminzz from /home/safei/backups/adminzz/ to /home/adminzz/backup_temp/

rsync -avzh /home/safei/backups/adminzz/ /home/adminzz/backup_temp/


  • Copy/Sync Files and Directory to or From a Server
  • Copy a Directory from Local Server to a Remote Server

Copy/Sync local backups directory to the remote backup server

rsync -avz /home/safe/backups/ root@


  • Copy/Sync a Remote Directory to a Local Machine

Copy/Sync backups from the remote backup server to client adminzz account

rsync -avz root@ /home/adminzz/backup_temp/


  • Rsync with non-standard SSH Port

rsync -arvz -e 'ssh -p <port-number>' --progress --delete username@remote_server_ip:/path/to/remote/folder /path/to/local/folder

Copy/Sync local backups directory to remote backup server with port 1234

rsync -arvz -e 'ssh -p 1234' --progress --delete adminzz@ /home/rootadminz/backups/

Hasznosnak találta ezt a választ? 0 A felhasználók hasznosnak találták ezt (0 Szavazat)