2015/09/11

How to compress and decompress directory in Linux ?

1/
Compress and pack directory:

tar -zcvf archive.tar.gz directory/

c (create) - an archive from the files in directory (tar is recursive by default),
z (gzip)  - compress it using the gzip algorithm,
f (file) - store the output as a  named archive.tar.gz,
v(verbosely) list all the files it adds to the archive.

2/
Decompress and unpack the archive into the current director:

tar -zxvf archive.tar.gz

No comments:

Post a Comment