← Cheat Sheets

tar, gzip and zip

Archive and compress files.

# tar, gzip and zip

Archive and compress files.

```bash
tar -czf archive.tar.gz folder/   # create gzip archive
tar -xzf archive.tar.gz            # extract
tar -xzf a.tar.gz -C /target       # extract elsewhere
tar -tf archive.tar.gz             # list contents
gzip file                          # compress (replaces file)
gunzip file.gz
zip -r archive.zip folder/
unzip archive.zip -d target/
```

Flags: **c** create, **x** extract, **t** list, **z** gzip, **f** file name, **v** verbose.