What are hard and soft quoting issues with `find -exec` vs `xargs`?
AdvancedConceptPackages, Shell & Text Tools
Answer
find -exec cmd {} \; runs one process per file (slow); find -exec cmd {} + batches arguments like xargs. Plain find | xargs breaks on filenames with spaces or newlines; use -print0 | xargs -0. xargs -P 8 runs in parallel.
find /data -name '*.log' -mtime +30 -exec gzip {} +
find . -type f -print0 | xargs -0 -P 8 -n 50 sha256sum
More on Packages, Shell & Text Tools
Compare apt and dnf package management.BeginnerWhat is the difference between `apt upgrade` and `apt full-upgrade`?IntermediateHow do you find which package provides a file or command?BeginnerHow do you pin or hold a package version?IntermediateHow are repositories and their GPG keys configured?AdvancedWhat is the difference between a login shell and an interactive non-login shell?Intermediate