A hands-on walk-through to create an archive, remove originals, restore files and verify integrity using tar. 12.01.2026 | reading time: 2 min Want proof that your tar backups really restore? This short lab shows how to archive a small directory, simulate data loss, restore the archive and verify the result so he can trust the process. A reproducible example Create a sample site, archive it, delete it, then restore and check contents with these commands and their expected output. ```bash mkdir -p /tmp/website echo "index" > /tmp/website/index.html echo "config" > /tmp/website/config.yaml tar -czvf /tmp/website-backup.tar.gz -C /tmp website ``` Expected tar output: `website/` then `website/index.html` then `website/config.yaml`. Now remove the original and confirm it is gone: ```bash rm -rf /tmp/website ls /tmp | grep website || echo "gone" ``` Expected output: `gone`. Restore from the archive and watch the files reappear: ```bash tar -xzvf /tmp/website-backup.tar.gz -C /tmp ``` Expected tar output: the same three entries; verify file content quickly: ```bash cat /tmp/website/index.html ``` Expected output: `index`. Options that matter in real life Use `-C` to control extraction path, `-z`/`-j`/`-J` to choose gzip/bzip2/xz compression, and `--exclude` to omit caches or secrets; preserve permissions with `-p` when extracting as root and prefer `--numeric-owner` for reproducible ownership; consider `--listed-incremental` for snapshot-style incremental backups and stream archives over SSH with `tar -czf - dir | ssh host "cat > /path/backup.tar.gz"` for remote backups. When tar is not enough Tar handles archiving and metadata well, but it lacks built-in deduplication, encrypted remote storage and efficient incremental chaining; for those use cases consider specialized tools or combine tar with encryption and transfer utilities. Final thought and next steps Testing restores is the only proof that a backup works; build a habit of regular restore drills and automate them in scripts so he does not discover failures too late; to deepen Linux skills consider exam preparation for CompTIA Linux+ or LPIC-1 with intensive courses at bitsandbytes.academy. Join Bits & Bytes Academy First class LINUX exam preparation. backup filesystem utilities storage troubleshooting