Save your sanity when tarring up messy directories
Backup & Recovery (Rsync/Tar/Dd)
Save your sanity when tarring up messy directories
🧩 The Challenge
You ever try to archive a directory only to realize halfway through that your backup contains ten thousand cached node modules you didn’t need? Watching a transfer crawl because you included junk you don’t even want is infuriating.
💡 The Fix
Start using exclusion files to keep your tarballs lean and clean. It saves space and stops you from wasting cycles backing up garbage.
tar --exclude-from=exclude_list.txt -cvf backup.tar /path/to/source
⚙️ Why It Works
Passing a file to this flag lets you list patterns line-by-line, which is way cleaner than stringing together a dozen –exclude flags in your command. You can keep that list in version control or just keep it in the project root to reuse later.
🚀 Pro-Tip: Use absolute paths in your exclusion file if you want to avoid matching unexpected subdirectories by accident.
Linux Tips & Tricks | © ngelinux.com | 7/13/2026
