Index

zip files

view zip files contents
unzip -l [file]
less [file]
view [file]

zip

zip all files in a directory
zip file.zip *
zip directory recursive
zip -r file.zip [directory]

zipmerge

efficiently merge multiple zip files into a single zip file
zipmerge [destination] [source]...

7za

create an encrypted zip wit password protection
7za a -tzip -p[password] -mem=AES256 secure.zip [directory]

unzip

unzip complete zip file
unzip file.zip
dump specific zipped file to console
unzip -c file.zip '[file_in_zip]'
unzip complete zip to a directory
unzip file.zip -d destination_folder
skip existing files without prompt
unzip -n file.zip
overwrite existing files without prompt
unzip -o file.zip
unzip multiple zip files (use quotes)
unzip '*.zip'

tar.gz files

flags
v: verbose => list all files
x: extract files (as opposed to collecting)
z: decompress using gzip (required for .gz files)
f: file => this must be the last flag of the command, and the tar file must be immediately after.

--remove-files => remove files from disk after adding them to the archive
list all files
tar -tzf [name].tar.gz
list all files verbose (access, size, timestamp)
tar -vtzf [name].tar.gz
Extracting an archive
tar -zxf [name].tar.gz
Extracting an archive verbose => prints all files while extracting
tar -vzxf [name].tar.gz
strip container folder (don't create unnecessary directory, extract to root)
tar -zxf [name].tar.gz --strip 1
extract to specified directory
tar -zxf [name].tar.gz -C [directory]
create tar file
tar -cvf output.tar [file]...
create tar.gz file
tar -czvf output.tar.gz [file]...