Terminal

Bash scripts, command line tips, etc.

Typical rsync flags

I always forget the proper flags and options for a typical, sync everything rsync command, so for reference here is what I typically use:

rsync -avz --progress --stats --human-readable /source /dest

Progress, stats, and human-readable make the output nice. “a” turns on archive mode, which ensures that symbolic links, devices, attributes, permissions, ownerships, etc are preserved in the transfer. ”v” makes it more verbose. “z” compresses the data during transfer.

-e ssh # Good when you want to transfer between servers
--del # This will delete orphaned files in the destination
--exclude="_log/*" # It excludes the pattern. You can have many.