linux-cli

Syntax

rsync -a /boot/grub /data/backup erzeugt einen Unterordner /grub in /data/backup.
rsync -a /boot/grub/ /data/backup heißt, dass alle Daten von /boot/grub/ tatsächlich in das Verzeichnis /data/backup geschrieben werden.

rsync -a /boot/grub /data/backup # Ist identisch zu:
rsync -a /boot/grub/ /data/backup/grub

Backups

Syncing a vault via ssh and rsync

sshfs g7:/data/data/com.termux/files/home/storage/shared/ /mnt/mass
rsync -abviuzP --suffix .bak --exclude ".*" vault/ /mnt/mass/vault/

How to delete things on remote that I removed locally

--delete                delete extraneous files from dest dirs
--delete-before         receiver deletes before xfer, not during
--delete-during         receiver deletes during the transfer
--delete-delay          find deletions during, delete after
--delete-after          receiver deletes after transfer, not during
--delete-excluded       also delete excluded files from dest dirs

Flags

-a --archive

  • archive mode; equals -rlptgoD (no -H,-A,-X)

This is equivalent to -rlptgoD. It is a quick way of saying you want recursion and want to preserve almost everything (with -H being a notable omission). The only exception to the above equivalence is when --files-from is specified, in which case -r is not implied. Note that -a does not preserve hardlinks, because finding multiply-linked files is expensive. You must separately specify -H.

-h --human-readable

  • output numbers in a human-readable format

-z --compress

  • compress file data during the transfer

-P --progress

  • show progress during transfer

-x --one-file-system

  • do not cross filesystem boundaries

-n --dry-run

  • runs the command and shows affected files without actually changing anything