

That is it with extracting tar files to a specific directory and also extracting specific files from a tar file.
Linux untar gz archive#
Img 05: Extract Specific Files From Tar Archive Summary # tar -xvf etc.tar etc/issue etc/nf etc/mysql/ -C /backup/tar_extracts/ In the next example, I will extract specific files out of a tar file to a specific directory as follows: # mkdir /backup/tar_extracts The tar utility also allows you to define the files that you want to only extract from a. Img 04: Extract tar.bz2 Files to Different Directory Example 4: Extract Only Specific or Selected Files from Tar Archive # tar -jvxf documents.tbz2 -C /tmp/tar.bz2/ Now we will be unpacking the documents.tbz2 files to /tmp/tar.bz2/ directory. tbz2 Files to Different DirectoryĪgain repeating that you must create a separate directory before unpacking files: # mkdir -p /tmp/tar.bz2 tgz Files to Different Directory Example 3: Extract tar.bz2. Now we will extract the contents of documents.tgz file to separate /tmp/tgz/ directory.

tgz Files to Different Directoryįirst make sure that you create the specific directory that you want to extract into by using: # mkdir -p /tmp/tgz Img 02: Extract Tar Files to Specific Directory Example 2: Extract. # tar -xvf articles.tar -directory /tmp/my_articles/

Let me also use the -directory option instead of -c for the example above. In the above example I used the -v option to monitor the progress of the tar extraction. Img 01: Extract Tar Files to Different Directory To extract the files in articles.tar to /tmp/my_article, I will run the command bellow: # tar -xvf articles.tar -C /tmp/my_article/ You can include the -p option to the above command so that the command does not complain. Let me start by creating the /tmp/my_article directory using the command below: # mkdir /tmp/my_article Always make sure that the directory into which you want to extract tar file exists. In the first example, I will extract the files in articles.tar to a directory /tmp/my_article. Example 1: Extracting tar Files to a Specific Directory Using pv, we can monitor the progress of the decompression process pigz -dc us now look at some examples below.
Linux untar gz install#
Pipe viewer can be installed in CentOS or RHEL using the following command yum install pv It can be inserted into any normal pipeline between two processes to give a visual indication of how quickly data is passing through, how long it has taken, how near to completion it is, and an estimate of how long it will be until completion. PV (“Pipe Viewer”) is a tool for monitoring the progress of data through a pipeline. If you want to see the progress of the extraction process, you need to use Pipe Viewer ( pv). The command to extract a tar.gz file using pigz is given below. Ensure epel repository is enabled in your system yum install pigz The command to install pigz in CentOS or RHEL is given below. But overall performance is far better than the normal gzip. The extraction happens in a single thread. It uses multiple threads for reading, writing and checksum calculations. I searched a lot and finally figured out a solution. I want to speed up the extraction as the normal extraction was taking approximately a day. f : Specify an archive or a tarball filename. v : Verbose output or show progress while extracting files. tar.bz2 (bzip2) file, enter (note -j option): tar -xjvf 2 Where, -x : Extract a tar ball. Recently I got a tar.gz file of around 30 GB and on extraction it will become approximately 4TB. tar.gz (gzip) file, enter (note -z option): tar -xzvf To extract / unpack a.
