Archives: tar and gzip
A backup you have never restored is not a backup. In this lesson you pack a directory into an archive, confirm it is compressed, and restore it elsewhere, comparing it to the original byte for byte. The sandbox already has a ~/project directory.
Steps
1. Pack
Gather the directory into one compressed archive. The czf flags: create (c), gzip (z), to a file (f). -C ~ tells tar to step into the home directory so the paths inside the archive stay short.
tar czf ~/project.tar.gz -C ~ project
tar tzf ~/project.tar.gz # list the contents2. Check the compression
gzip -t checks that the archive is valid gzip, and gzip -l shows the compression ratio.
gzipLocked
The rest of this lesson is part of a paid course
You are reading the open part. Buy the course to unlock the whole lesson and its lab.