Archive Files and Directories


To compress files:
$ tar -czvf ⟨archive-name⟩.tar.gz ⟨list-of-files-and-dirs⟩

Compression options: z - gzip, j - bzip2, J - xz.

Multi-thread compress:
$ tar -c ⟨directory⟩/ | pigz > ⟨directory⟩.tar.gz


$ tar -xf ⟨archive⟩.tar.gz

List Files

$ tar -tf ⟨archive⟩.tar.gz

$ unzip -l ⟨archive⟩.zip

Extract a Specific File

$ tar -xf ⟨archive⟩.tar.gz ⟨path/to/a/specific/file⟩

$ unzip -p ⟨archive⟩.zip ⟨path/to/a/specific/file⟩ > file

GNU tar

Password Protection

To create a password protected 7z-archive with encrypted file list

$ 7z a -p -mhe=on ⟨archive⟩.7z ⟨list-of-files-and-dirs⟩