User Tools

Site Tools


bash:files:extract_specific_file_s_from_tar.gz

BASH - Files - Extract specific file(s) from tar.gz

To list the contents of an archive called tarball.tar.gz use this command:

tar -tzf tarball.tar.gz

Example:

tarball/file1.txt
tarball/.bash_logout
tarball/file2.txt
tarball/bash.txt
tarball/.bash_history

Then you extract whatever you wish using this command:

tar -zxvf tarball.tar.gz tarball/bash.txt

Example:

find . -type f
./tarball/bash.txt
./tarball.tar.gz

To extract a few files use this:

tar -zxvf tarball.tar.gz tarball/bash.txt tarball/file1.txt
 
 
find . -type f
./tarball/bash.txt
./tarball/file1.txt
./tarball.tar.gz
bash/files/extract_specific_file_s_from_tar.gz.txt · Last modified: 2022/06/13 11:17 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki