Unzip Different files from CLI

Unzip tar.gz:

tar –xvzf documents.tar.gz

The basic command is tar, followed by four options:

x – instructs tar to extract the files from the zipped file
v – means verbose, or to list out the files it’s extracting
z – instructs tar to decompress the files – without this, you’d have a folder full of compressed files
f – tells tar the filename you want it to work on


To instruct tar to put the extracted unzipped files into a specific directory, enter:
tar –xvzf documents.tar.gz –C /home/user/destination

Source: https://phoenixnap.com/kb/extract-tar-gz-files-linux-command-line
Date: June 3rd 2022

-------------------------------------------------------------------------------------------------------

Extract or Unzip tar.xz File

tar -xf file.tar.xz

In here:
-x means extract the archived file
-f means following is the archived file name


Source: https://linuxhandbook.com/extract-tar-xz/
Date: June 3rd 2022

-------------------------------------------------------------------------------------------------------

How to Extract (Unzip) tar.bz2 File

tar -xvf archive.tar.bz2
This (-v) will list all files being extracted.

To exsctrat one ro more folder or files, use one of these commands (depending if it is a file or folder):
tar -xf archive.tar.bz2 file1 file2
tar -xf archive.tar.bz2 dir1 dir2

To exsract to a specific directory:
tar -xf archive.tar.bz2 -C ~/my_wanted_folder

Source: https://linuxize.com/post/how-to-extract-unzip-tar-bz2-file/
Date: June 3rd 2022.

-------------------------------------------------------------------------------------------------------

Back