HomeCheat SheetsTar, Gzip & Linux Compression Cheat Sheet
100% Client-Side β€’ 0 B Data Leaves Browser
linux

Tar, Gzip & Linux Compression Cheat Sheet

Quick reference for tar, tar.gz, tar.bz2, zip, and unzip commands on Linux, macOS, and WSL.

Tar.gz Creating & Extracting

Create a gzipped tar archive with verbose outputtar -czvf archive.tar.gz /path/to/folder
Extract a gzipped tar archive into current directorytar -xzvf archive.tar.gz
Extract archive into specific target directorytar -xzvf archive.tar.gz -C /target/dir
List archive contents without extracting files to disktar -tzvf archive.tar.gz

Zip, Bzip2 & Gzip Standalone

Create a standard .zip archive of a directoryzip -r archive.zip folder/
Extract .zip archive into target directoryunzip archive.zip -d /target/dir
Compress single file to file.txt.gz (removes original)gzip file.txt
Decompress gzipped file back to file.txtgzip -d file.txt.gz

Frequently Asked Questions

β€’ What do the -czvf flags stand for in tar?

-c = create archive, -z = gzip compression, -v = verbose output, -f = specify archive filename.