CLI Part 5. Compression and Archives

zip / unzip - archive and compression utilities

Will compress and decompress archive files or folders using zip compression.

Example:

$ zip myArchive.zip file1.txt file2.txt myDirectory
$ unzip myArchive.zip
$ find . -name *.jpg -exec zip -R image.zip  {} \;

tar / gzip - archive and compression utilities

Exactly the same in function as zip and unzip, and most commonly found in use on *nix based environments.

Example:

$ tar -cvvf myArchive.tar myDirectory
$ gzip myArchive.tar myArchive.tar.gz
$ gzip -d myArchive.tar.gz
$ tar -xvvf myArchive.tar

tar can also be used independently with gzip functionality (thanks to Alex Gorrod for this update):

Example:

$ tar -zcvf myArchive.tgz myDirectory
$ tar -zxvf myArchive.tar.gz

Comments:

Leave a comment