An archive file is a file that is composed of one or more computer files along with metadata. Archive files are used to collect multiple data files together into a single file for easier portability and storage, or simply to compress files to use less storage space. Archive files often store directory structures, error detection and correction information, arbitrary comments, and sometimes use built-in encryption. — Wikipedia

tar

Create

.gz

tar zcvf archive.tar.gz /path/to/archive

.bz2

tar jcvf archive.tar.bz2 /path/to/archive
  • z: gzip
  • j: bzip2
  • c: create
  • v: verbose
  • f: file

Extract

.gz

tar zxvf archive.tar.gz (-C /path/to/destination)

.bz2

tar jxvf archive.tar.bz2 (-C /path/to/destination)
  • z: gzip
  • j: bzip2
  • x: extract
  • v: verbose
  • f: file
  • C: directory

bz2

Extract

bzip2 -d archive.bz2
  • d: decompress
  • k: keep input files

zip

Extract

unzip archive.zip (-d /path/to/destination)
  • d: exdir

rar

Extract

unrar e/x archive.rar
  • e: extract files to current directory
  • x: extract files with full path

7z

Extract

7z e/x archive.7z
  • e: extract files from archive (without using directory names)
  • x: extract files with full path

xz

Extract

unxz archive.xz

or

xz --decompress archive.xz