Configure cp and rsync to preserve metadata by default

Metadata is data; losing it by accident when using common command-line
tools is data loss.

Let's harden against this by aliasing `mv` and `rsync` to versions of
themselves with metadata-preserving arguments invoked by default,
similar to what we do for `grep` to enable colorized output.
This commit is contained in:
Nate Graham
2026-03-31 09:34:25 -06:00
parent 6f1ccfcbaf
commit f236f97981

View File

@@ -83,6 +83,10 @@ zstyle ':completion:*' menu no
alias ls='ls --color=auto'
alias grep='grep --color=auto'
# Preserve metadata by default; match the behavior of `mv`.
alias cp='cp --preserve=all'
alias rsync='rsync --perms --xattrs --acls --times --atimes --crtimes'
# Add various useful aliases.
alias la='ls -A'
alias ll='ls -l'