Linuxlab

Backup and restore

Updated July 3, 2026

A backup only matters if you can restore from it. The test is to extract into a clean place and compare with the original.

tar czf backup.tar.gz -C ~ project
mkdir ~/restore && tar xzf backup.tar.gz -C ~/restore
diff -r ~/project ~/restore/project && echo OK

diff -r compares two trees quietly; if it prints nothing, the contents match. For regular copies between machines people use rsync (that is the network, Part III).

Used in

You need this in the lesson Archives: tar and gzip.