Archiving/Unarchiving with tar

NOTE: this website is out of date. This is the course web site from a past quarter. If you are a current student taking the course, you should visit the current class web site instead. If the current quarter's website is easily reached, it may be accessible by visiting this link instead. Please be advised that courses' policies change with each new quarter and instructor, and any information on this out-of-date page may not apply to you.

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
$