Linux Extract tar.gz, tar.bz2, unzip Command

We often download the files on the Internet. The files are usually in order to compress it into a smaller size. There is also a file that is compressed during use. In this article, I will share knowledge about how to extract a file with the extension zip, tar.gz and tar.bz2 in Linux. For the differences between files you try searching on Goolge.
untar linux,linux tar command,linux tar examples,linux tar.gz,unzip gz file,linux extract tar.gz
Okay let's get started, here's how to extract tar.gz, tar.bz2 and zip files. Open a terminal, then go to the linux tar directory where the file you want to extract is located. The next step is just typing the following linux tar command:
unzip yourfilenamename.zip (for files with the extension zip)
tar zxvf yourfilenamename.tar.gz (for files with the extension tar.gz)
tar jxvf yourfilenamename.tar.bz2 (for files with the extension tar.bz2)

Linux extract tar.gz only some files

Then how to untar linux only some files? Previously you had to list the contents of the file yourfilename.tar with the following command:
# tar -tf yourfilename.tar
or
# tar -ztf yourfilename.tar.gz

Linux tar examples. Samples of the output like this:
# tar -tf yourfilename.tar
yourfilename/
yourfilename/doc1.ods
yourfilename/doc2.ods
yourfilename/doc3.ods

Once the results are as above, for example, you will only untar doc3.ods, then you would type the following command:
# tar -xtf yourfilename.tar yourfilename/doc3.ods
That's some way to unzip and untar linux. Please you try it, hopefully it can be helpful and useful for you.

Related post :

No comments :