gzip
-
Extract
.tar.gzfile:1$ tar xvzf ./file.tar.gz
-
Extract only one subdirectory and all its sub-content:
1$ tar -xvzf my-archive.tar.gz --wildcards "./directory/subdirectory*"
-
Create a
.tar.gzfile:1$ tar cvzf file.tar.gz ./subfolder
-
Extract all
.gzfiles in the current folder:1$ gunzip ./*.gz
-
Convert
.tar.gzfile to.tar.bz2file:1$ gzip -dc archive.tar.gz | bzip2 > archive.tar.bz2
bzip2
-
Extract
.tar.bz2file:1$ tar xvjf ./file.tar.bz2
-
Check a
.bz2file integrity:1$ bzip2 --test ./file.bz2
-
Extract
./path/in/archive*subfolder content from all.tar.bz2archives available in the current folder. Place the extracted content of each archive in a folder prefixed with thecontent-string:1$ for ARCHIVE in `ls *.tar.bz2`; do DEST_FOLDER=content-`echo $ARCHIVE | cut -d '.' -f 1`; mkdir $DEST_FOLDER; tar -C $DEST_FOLDER -xvjf $ARCHIVE --wildcards "./path/in/archive*"; done
ZIP
-
Create a
.ziparchive of current directory, including all sub-dirs:1$ zip -r archive.zip ./*
-
One liner to download an archive and extract its content to a target folder:
1$ wget -O - "https://example.net/archive.zip" | tar -xz --directory /target-folder -f -
7-Zip
-
Create a 7-Zip archive (thanks to
p7zip) of a folder, including all sub-directories:1$ 7za a archive.7z ./folder
-
Do the same as above, but split the archive in 50 Mib volumes:
1$ 7za a -v50m archive.7z ./folder