How to extract all .htaccess files from a tarball

filenamestarwildcards

I want to extract all .htaccess files from a tarball, how can I do so? I see only one mention of "include" in the manual page of tar which is not related with an option for including only certain filenames at all.

Is there an alternative other than mentioning all paths as argument?

Best Answer

GNU tar supports "--wildcards" option.

tar tvfz file.tar.gz --wildcards '*/.htaccess'
Related Question