Today we will use tar as a backup tool. Note that this lab is intentionally short to permit demonstrations of missing labs.
Use tar to create a compressed backup file of the /etc directory on your sandbox OS drive.
Use other options for tar to extract (restore) a copy of /etc/hosts (and nothing else) from the backup file you created above.
Take a look at the simple make_snapshot.sh rsync script that can be used to create a rotating filesystem snapshot. This particular version has some features commented out (mounting and re-mounting filesystems) but it uses an interesting option to cp to copy using hard-links (which only copies the name, not the file contents) so that a duplicate of a directory (including contents and subdirectories) takes very little space. It then uses rsync to make the copy up-to-date with an existing directory (often NFS mounted).
Finally, notice how it renames directories so that no more than 4 copies of the directory are retained.
The script uses a set of files to determine what to backup and what to ignore. A sample include file set might be:
Create your own include and exclude files, modify the backup script appropriately, and make a couple of backups of some directory that has files (making some changes between).