Zipping Commands Cheat Sheet (WIP)
Linux
Tar
man tar
# Create a tar archive:
tar -cf archive.tar file1 file2 directory
# Extract files from a tar archive:
tar -xf archive.tar
# List files in a tar archive:
tar -tf archive.tar
# Extract files from a specific directory in a tar archive:
tar -xf archive.tar -C destination_directory
# Create a tar archive with compression:
tar -czf archive.tar.gz file1 file2 directory
Gzip
man gzip
# Compress a file:
gzip file
# Decompress a file:
gzip -d file.gz
# Keep the original file when compressing:
gzip -k file
# Compress a file with maximum compression level:
gzip -9 file
Windows
Compress-Archive
Compress-Archive docs
Expand-Archive docs
# Create a zip archive:
powershell Compress-Archive -Path file1,file2,directory -DestinationPath archive.zip
# Extract files from a zip archive:
powershell Expand-Archive -Path archive.zip -DestinationPath destination_directory
7-Zip
7z command guide
# Create a zip archive:
7z a archive.zip file1 file2 directory
# Extract files from a zip archive:
7z x archive.zip