Wednesday, August 19, 2015

How to open a tar file in Unix

How to open or Untar a "tar.gz" file in Unix:

Assume your file is myfile.tar.gz 
Type below command to first unzip the gz file
     tar -zxvf myfile.tar.gz
It will extract the all files to current directory.  You can also specify a different directory to extract to using -C parameter and a path to the directory as follows:
     tar -C /pathToFolder -zxvf myfile.tar.gz

How to open or Untar a "tar" file in Linux or Unix:

Type  below command to extract file. It will extract file to the current directory
     tar -xvf myfile.tar
Or to extract the file to the another directory
     tar -C /pathToFolder -xvf myfile.tar