tar extract to folder code example

Example 1: extract tar.gz ubuntu terminal

tar -xvf yourfile.tar.gz

Example 2: how to unzip Tar file

## Untar files in Current Directory ##
tar -xvf filename.tar.gz

## Untar files in specified Directory ##
tar -xvf filename.tar.gz -C /path_name_for_unzip/

-x : extract
-C : specified directory
-v : Verbosely show the .tar file progress.
-f : filename of archive file

Example 3: uncompress tar

tar -xvf filename.tar

Example 4: untar .tar file

tar -xvf yourfile.tar

Example 5: extract from tar gz into folder

mkdir foo
tar -xzf bar.tar.gz -C foo

Example 6: tar to directory

tar -xf file_name.tar -C /target/directory

Tags:

Misc Example