Archives for 

Tar

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

How to split a big tar files?

 How to split a big tar files? Easy 😉 split -b 100000000 thisfile.tar.gz thisfile.tar.gz This will split your file into 100 MB parts with the thisfile name and suffix of gzaa, gzab, gzac, etc… Then how to join them? Easy too 😉 cat thisfile.tar.gz?? > thisfile.tar.gz Until next time 🙂 Continue reading →