Usage Tips:
- Click on a keyword to enable inline editing.
- Click inside a code block to copy (excludes comments).
- Use the button to view examples.
- Click outside to collapse all examples.
Hint: Always put the zip file inside a new folder before unzip
# zip a file
zip <FILE>.zip <FILE>
Sample Output:
TO-DO
# zip a folder
zip -r <FOLDER>.zip <FOLDER>/
Sample Output:
TO-DO
# zip a symlink (not the destination file)
zip --symlinks file.zip <SYMLINK>
Sample Output:
TO-DO
# List files without unzip
unzip -l <FILE>
Sample Output:
TO-DO
# unzip
unzip <FILE>
Sample Output:
TO-DO
# zip (Windows)
Compress-Archive -Path "<FILE_PATH>" -DestinationPath "<DEST_PATH>"
Sample Output:
TO-DO
# zip a folder (Windows)
Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory('<FILE_PATH>', '<DEST_PATH>')
Sample Output:
TO-DO
# unzip (Windows)
Expand-Archive -Path "<FILE_PATH>" -DestinationPath "<DEST_PATH>" -Force
Sample Output:
TO-DO
# unzip (Windows)
Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory('<FILE_PATH>', 'C:\ProgramData\')
Sample Output:
TO-DO
# Compress a file
tar -cvzf <FILE>.tar.gz <FILE>
Sample Output:
TO-DO
# Compress a folder
tar -cvzf <FOLDER>.tar.gz <FOLDER>/
Sample Output:
TO-DO
# Extract
tar -xvzf <FILE>
Sample Output:
TO-DO
# Extract filter with wildcard (e.g. .txt)
tar -xvzf <FILE> --wildcards '*.txt'
Sample Output:
TO-DO
# List files without extract
tar -tf <FILE>
Sample Output:
TO-DO
# Extract
tar -xvf <FILE>
Sample Output:
TO-DO
# Extract filter with wildcard (e.g. .txt)
tar -xvf <FILE> --wildcards '*.txt'
Sample Output:
TO-DO
# Compress file, and keep the original file
gzip -k -r <FILE>
Sample Output:
TO-DO
# Compress all files individually inside a folder, and keep original files
gzip -k -r <FOLDER>/
Sample Output:
TO-DO
# Extract
gunzip <FILE>
Sample Output:
TO-DO
Note: If you want to zip the entire folder, use tar instead
# Extract
unrar e <FILE>
Sample Output:
TO-DO
# Install
sudo apt install p7zip-full
Sample Output:
TO-DO
# Extract
7z x <FILE>
Sample Output:
TO-DO
# Show meta data
7z l -slt <FILE>
Sample Output:
TO-DO
# Extract and keep original files
bunzip2 -k <FILE>
Sample Output:
TO-DO