Linux : Compress entire folder to .gz or .bz2

Like Tweet Pin it Share Share Email

gzip / bzip2 can compress individual files. To compress entire folder structure ‘tar’ command comes to our rescue.

Compress to .gz 

tar -zcf </path/output.gz>  /sourcefolder/path

Compress to .bz2

tar -jcf </path/output.bz2> /sourcefolder/path

tar options :

-z : gzip
-c : compress
-f : filename
-j : bzip2


Comments (0)

Leave a Reply

Your email address will not be published. Required fields are marked *