Skip to main content

How to create and extract zip, tar, tar.gz and tar.bz2 files

ZIP
Compress:
# zip -r archive_name.zip directory_to_compress

Extract:
# unzip archive_name.zip


TAR
Compress:
# tar -cvf archive_name.tar directory_to_compress

Extract:
# tar -xvf archive_name.tar.gz
# tar -xvf archive_name.tar -C /tmp/extract_here/


TAR.GZ
Compress:
# tar -zcvf archive_name.tar.gz directory_to_compress

Extract:
# tar -zxvf archive_name.tar.gz
# tar -zxvf archive_name.tar.gz -C /tmp/extract_here/


TAR.BZ2
Compress:
# tar -jcvf archive_name.tar.bz2 directory_to_compress

Extract:
# tar -jxvf archive_name.tar.bz2 -C /tmp/extract_here/


How to create and extract zip, tar, tar.gz and tar.bz2 files

Comments