In this lab, students will create and extract archives with tar.
Outcomes
Students will back up a directory tree and extract the archive content to another location.
Since only the root user can read all the contents of the /etc directory, we are going to back up the directory and log into serverX as root.
[student@desktopX ~]$ssh root@serverX
Create an archive of /etc using gzip compression to back up the configuration file directory /etc. Save the file as /tmp/etc.tar.gz.
[root@serverX ~]#tar czf /tmp/etc.tar.gz /etc
Verify that the backup file etc.tar.gz is a valid archive by decompressing the file to a newly created directory named /backuptest on serverX.
Create the target directory /backuptest.
[root@serverX ~]#mkdir /backuptest
Switch to the /backuptest directory, where we will extract the files from the etc.tar.gz archive.
[root@serverX ~]#cd /backuptest
Extract the etc.tar.gz archive to the /backuptest directory.
[root@serverX backuptest]#tar xzf /tmp/etc.tar.gz