extract tar in particular folder code example
Example 1: extract from tar gz into folder
mkdir foo
tar -xzf bar.tar.gz -C foo
Example 2: tar to directory
tar -xf file_name.tar -C /target/directory
mkdir foo
tar -xzf bar.tar.gz -C foo
tar -xf file_name.tar -C /target/directory