How do I delete a single file from a tar.gz archive

后端 未结 5 1987
花落未央
花落未央 2021-02-19 01:58

I have a huge tarbell archive with an excessively large or corrupt error_log that causes the archive to hang when attempting to extract it. Is there a way to remove this from th

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-19 02:24

    You can repackage it like this:

    tar -czvf ./new.tar.gz --exclude='._*' @old.tar.gz
    

    I used ._* to remove all ._files, but you can use any pattern you like, including a full path, directory, filename, or whatever.

提交回复
热议问题