Tar file can be opened using tar -zxvf command.
1. From the terminal, change to the directory where tar file is located.
2. Now to extract the file to the current directory , run the command
tar -zxvf test.tar.gz
To extract the file to a specific directory , run
tar -C /directory_name -zxvf test.tar.gz
NOTE : The extensions .tgz and .tar.gz are equivalent and both signify that a tar file zipped with gzip.
How to Untar a “.tar” file ?
1. From the terminal, change to the directory where tar file is located.
2. Now to extract the file to the current directory , run the command
tar -xvf test.tar
To extract the file to a specific directory , run
tar -C /directory_name -xvf test.tar
Tar Usage and Options
- c – create a archive file.
- x – extract a archive file.
- v – show the progress of archive file.
- f – filename of archive file.
- t – viewing content of archive file.
- j – filter archive through bzip2.
- z – filter archive through gzip.
- r – append or update files or directories to existing archive file.
- W – Verify a archive file.
- wildcards – Specify patters in unix tar command.