Archiving/Unarchiving with tar

Written by Chris Gregg, with modifications by Nick Troccoli

Click here for a walkthrough video.

Although you won't directly use it in CS107, sometimes you will find files on a linux system that have the extension ".tgz" or ".tar.gz". These are compressed (like "zipped") files, and you use the tar ("Tape ARchive", from back when we routinely used magnetic tape to keep backups program to extract the files.

The easiest way to un-tar a file is to use the command with the -xvf flags:

$ tar -xvf file.tar.gz
...lots of files
$

To create an archive file that is compressed, use the -czvf flags:

$ tar -czvf file.tar.gz someFolder
...lots of files added
$