Wednesday, March 3, 2010

Create and extract tar.gz files

This post is intended as a self reminder.

To create a *.tar.gz file:
tar -czf filename.tar.gz dirpath

To extract a *.tar.gz file:
tar -xzf filename.tar.gz

Explanation of -czf:
c: create archive
z: pass the archive through gzip (to create .tar.gz vs .tar)
f: the following argument specifies the filename to use

Explanation of -xzf:
x: extract from archive
z: pass the archive through gunzip (to extract from .tar.gz vs .tar)
g: the following argument specifies the filename (the archive file) to use

1 comment: