extract one file from a tar.gz

Reading Time: < 1 minute You can simply use the following syntax:

[root@blub ~]# tar tzvf mytar.tar.gz
That will show you the list of files in the tar. t means test
 
[root@blub ~]# tar tzvf mytar.tar.gz myfile.txt
 -rw-rw-r-- scm/scm 373093723 2010-09-17 17:58:21 myfile.txt
You can do the same with a target file and test that one specific file really belong to a tar.gz

Finally you can extract that single file.

Reading Time: < 1 minute

You can simply use the following syntax:

[root@blub ~]# tar tzvf mytar.tar.gz
That will show you the list of files in the tar. t means test
 
[root@blub ~]# tar tzvf mytar.tar.gz myfile.txt
 -rw-rw-r-- scm/scm 373093723 2010-09-17 17:58:21 myfile.txt
You can do the same with a target file and test that one specific file really belong to a tar.gz

Finally you can extract that single file.

[root@blub ~]# tar xzvf mytar.tar.gz myfile.txt
 

By Marc Olivier Meunier

Marc has spent the past 7 years putting oil on the fire of a hyper growth ad tech company. At Smartly.io he was in charge of scaling the support and its culture. He leads by example and puts a lot of emphasis on diversity and inclusion, constantly working to create a safe environment. A warm leader with a passion for memorable experiences and innovation.
Find me on Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *