Lately I have been working with some large tarballs (tar.gz files). To access the compressed contents, usually I would extract all the files that were compressed in the archive. This was time consuming to decompress all the files, a pain to filter through looking for the files I wanted, and required more time to delete everything I didn't want. I knew there was a better way to just get the files I wanted. Sure enough, the basic
tar command has options that allow you just to extract a file of interest or even a set of files using wildcards. The command looks like this:
where,
big_file.tar.gz is the tarball you are extracting from
path is the path to your file in the tarball
your_file.txt is the file you want to extract
This can also be done using wildcards. For example, if I wanted all text files in the above path I could substitute *.txt for your_file.txt.
No comments:
Post a Comment