Simple tar and untar
It’s incredible the number of people who confuse tar, gzip not to mention the flags associated with these commands, note that the order is relevant.
Quick reminder:
taris an archiver used to to combine multiple files into onegzipis a compression tool used to reduce the size of a file
Now that you finally understand the difference, here’s how the basic operations work:
- Create a tarball with the content of a directory:
tar -cvf foo.tar foo/ -
Extract the content of a tarball:
tar -xvf foo.tar - Compress a tarball with
gzip, this will replacefoo.tarwith a compressed versionfoo.tar.gz:
gzip foo.tar -
Extract a gzipped tarball:
tar -xvzf foo.tar.gz


