Here’s a cheat-sheet for using gzip, bzip2, zip and tar! This should come in handy when handling archives.
Footnote: If you need more detail about archiving and compressing, check out the guide!
| Tar a Directory |
tar cvf archive.tar /home/user/directory |
| Tar + Bzip2 a Directory |
tar cjvf archive.tar.bz2 /home/user/directory |
| Tar + Gzip a Directory |
tar czvf archive.tgz /home/user/directory |
| Zip a Directory |
zip -r archive.zip /home/user/directory |
| Extract a Tar + Bzip2 Archive |
tar xjvf archive.tar.bz2 |
| Extract a Tar + Gzip Archive |
tar xzvf archive.tgz |
| Extract a Zip Archive |
unzip archive.zip |
| View the Contents of a Tar + Bzip2 Archive |
tar tjvf archive.tar.bz2 |
| View the Contents of a Tar + Gzip Archive |
tar tzvf archive.tgz |
| View the Contents of a Zip Archive |
unzip -l archive.zip |
Happy hacking!