Linux: Extract tar zip gzip lzip bzip2 xz rar

By Xah Lee. Date: . Last updated: .

here's how to unarchive or decompress files.

Extract Tar File (.tar)

tar xvf filename

unzip (.zip)

unzip filename

🟢 TIP: the command line program zip cannot be used to extract zip file.


7z x fileName

Decompress gzip (.gz)

gzip -d filename

or

gunzip filename

Extract lzip (.lz)

You have to install lzip. @ https://www.nongnu.org/lzip/lzip.html

lzip -d filename

Decompress bzip2 (.bz2)

bzip2 -d filename

Decompress xz (.xz)

xz -d filename

Extract rar file (.rar)

unrar e fileName

or

7z x fileName

Download file from web

Create file Archive, compress file

Extract archive, decompress file