Sometimes if we have unnecessary file or folder present in a massive tarball (.tar) file, then removing of particular unnecessary file or directory from tar file will take lot of time because of extracting and re-archiving the file.
how to remove file or folder from tar or zip file from delete option in ubuntu

So here we have easy trick where you can easily remove unnecessary file or folder without extracting tarball (.tar) file in ubuntu or any other linux platform.

Trick is we use  –delete  option that allows specified files or folders to be completely removed from a tar file without extracting tar file.

Let see how we remove file or folder from tar file,Just open your terminal by clicking CTRL-ALT-T.And I have a tar file  model.tar , So we will see what is inside of this tar file after using –list option with tar.

Try this in your terminal to list all file or folder present in model.tar file :-

Output of above command (These are files and folder present in model.tar file):-

So Now ,We will try to remove model/test folder from model.tar file :

Again after running –delete option , Let see final details of file or folder present in model.tar with –list option :

Finally here we have removed or deleted test folder by using –delete option without extracting file first.

So this is what result we were looking out.Let me know if you have any comment or suggestion regarding this topic.