How to use tar and extract everything except certain files?

I want to extract website.tgz, but I do not want them to "go out":

app/config.ini log/ 

How to do it?

Or / also how can I overwrite everything except the above?

+6
source share
2 answers

Try using the following command

 tar -xvzf /path/to/tarfile --exclude='file dont want to extract' 
+20
source

You can use, as Gryphius pointed out, the --exclude option for GNU tar .

You can also post-tar the tar archive with tardy .

tardy allows you to do other useful conversions (e.g. prefix archive file paths, change username or group, etc.).

+2
source

Source: https://habr.com/ru/post/951302/


All Articles