“rsync” is a file transfer program you can use to update files to (and from) a remote computer in an efficient way. It’s usually pre-installed in most Linux distros.

rsync -a -v -e "ssh -i <private-key-file>" <local-folder> <user>@<server-ip>:<remote-folder>
  • -a means “archive mode” and is a shortcut for recursive into directories, copy symlinks as symlinks, preserve permissions, preserve modification times, preserve group, preserve owner (using “sudo”), preserve device files (using “sudo”) and preserve special files.
  • -e allows to specify the remote shell to use, in this case it allows to specify the SSH parameters (private key and port, for example). If you connect to server with a password, you don’t need to add this parameter.
  • -v show the process.
  • You can exclude files with --exclude PATTERN:
    rsync -a <local-folder> <user>@<ip>:<remote-folder> --exclude "*.txt"