Menu Close

How to handle Tar/GZip and Tar/Bzip2 using the command line Terminal

Here’s a small manual how to use the Tar/GZip and Tar/Bzip2 achive files.

(Tar/GZip) archives end in ".tar.gz" and (Tar/Bzip2) archives end in ".tar.bz2". Bzip2 is the newer, more efficient compression method. These files can generally be automatically extracted by merely clicking on them from your file manager (Nautilus), since file associations with the appropriate archival utilities are set by default in Ubuntu. These instructions are for those who wish to use the command line Terminal.

        * To extract:

tar xvf packagename.tar.gz

Note: tar is an application which can extract files from an archive, decompressing if necessary.

        -x means extract.
        -v means verbose (list what it is extracting).
        -f specifies the file to use.

    * Decompressing ".gz" files

gunzip file.gz

    * Decompressing ".bz2" files

bunzip2 file.bz2

        Note: You can also decompress a package first by using the command gunzip (for .gz) or bunzip2 (for .bz2), leaving the .tar file. You would then use tar to extract it.

        * To create a .gz archive:

tar cvfz packagename.tar.gz folder

        * To create a .bz2 archive:

tar cvfj packagename.tar.bz2 folder
 

0 0 votes
Article Rating
Subscribe
Notify of
guest

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

0 Comments
Inline Feedbacks
View all comments