Sync Remote Directories

From Littledamien Wiki
Revision as of 14:46, 11 September 2021 by Video8 (talk | contribs)
Jump to navigation Jump to search

Use rsync on the command line:

$ rsync -av -e "ssh -p [NON_DEFAULT_SSH_PORT]" [USER]@[REMOTE_ADDRESS]:/path/to/remote/dir/ /path/to/local/dir
  • a flag: Stands for "archive" and copies recursively, preserving permissions, symbolic links, etc.
  • n flag: "Dry run" option for testing purposes.
  • v flag: Verbose.
  • e flag: Method for using a non-standard ssh port if the remote host is configured with a non-standard ssh port.

The order of remote vs local paths matters. Local path must be on the left in order push files on local to remote. Similarly, remote must be on the left to push files onto local.

Home directory on remote can be specified with ~ after the semicolon, e.g. [USER]@[REMOTE_ADDR]:~/path/below/home/