Omar Ramos Thoughts of a Webmaster

Home Tips & How-tos Linux How-to work with tar and gzipped files

How-to work with tar and gzipped files

E-mail Print PDF

How to gzip a tar file:

gzip filename.tar

How to decompress a gzip file back to a tar file:

gunzip filename.tar.gz

How to create a .tgz file from a set of folders:

tar -czvf filename.tgz /folder/to/backup

How to decompress a .tgz file:

tar -xzvf archive.tgz

How to extract files from a compressed tarball:

# extract to same directory
tar -xzf archive.tar.gz

# extract to a specific directory
tar -xzf archive.tar.gz -C /location/to/extract/to

How to list files in tar or compressed tar file

tar -tf archive.tar
tar -tzf archive.tar.gz

How to tell which versions of tar and gzip are installed on your machine:

tar --version

gzip -v
Last Updated ( Saturday, 31 January 2009 19:17 )  
1 Vote

0 Comments

Add Comment


    • >:o
    • :-[
    • :'(
    • :-(
    • :-D
    • :-*
    • :-)
    • :P
    • :\
    • 8-)
    • ;-)