- Extract
.tar.gzfile:tar xvzf ./file.tar.gz
- Extract only one subdirectory and all its sub-content:
tar -xvzf my-archive.tar.gz --wildcards "./directory/subdirectory*"
- Create a
.tar.gzfile:tar cvzf file.tar.gz ./subfolder
- 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: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
- Extract all
.gzfiles in the current folder:gunzip ./*.gz
- Extract
.tar.bz2file:tar xvjf ./file.tar.bz2
- Check a
.bz2file integrity:bzip2 --test ./file.bz2
- Create a
.ziparchive of current directory, including all sub-dirs:zip -r archive.zip ./*
- Create a 7-Zip archive (thanks to
p7zip) of a folder, including all sub-directories:7za a archive.7z ./folder
- Do the same as above, but split the archive in 50 Mib volumes:
7za a -v50m archive.7z ./folder
- Convert
.tar.gzfile to.tar.bz2file:gzip -dc archive.tar.gz | bzip2 > archive.tar.bz2
- Extract content from self-extracting shell archives:
unshar archive.sh
Archives commands
1