tar czf backup.tar.gz --exclude "cache" --exclude "*.tmp" /home/user
Create an archive skipping excluded patterns
Bundles /home/user while skipping anything matching the --exclude globs, here the cache folder and .tmp files. Put --exclude before the source paths. Repeat the flag for more patterns or use --exclude-from with a file.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.