How to tar.gz

tar is a program which combine several files into one (eg: files.tar). gz or gzip is a program to compress files (eg: files.gz).
Both are Linux programs. A tar.gz file is a resulting file from several files combined together and then compressed.

To combine and compress a folder:
tar czf filename.tar.gz /path/to/some/folder

To extract a tar.gz file:
tar -zxvf filename.tar.gz

To list all files in a filename.tar.gz:
gunzip -c filename.tar.gz | tar -tvf -

To extract one file from filename.tar.gz:
gunzip -c filename.tar.gz | tar -xvf - somefile.txt

There are also other way to compress and extract, but I personally like this one.

Update:
To extract a tar.bz2 file:
tar xvjf filename.tar.bz2

Tagged with 
About sepedatua
I am nothing special, of this I am sure. I am a common man with common thoughts and I’ve led a common life. There are no monuments dedicated to me and my name will soon be forgotten, but I’ve loved another with all my heart and soul, and to me, this has always been enough.

This site uses Akismet to reduce spam. Learn how your comment data is processed.