Bootstrap FreeKB - TAR - delete from an archive
TAR - delete from an archive

Updated:   |  TAR articles

Let's say you've created a tar archive named example.tar, and the tar archive contains the contents of the /tmp directory.

tar -cf example.tar /tmp

 

The tar command with the -t or --list and -f or --file optiions can be used to view the contents of the tar achive.

tar -tf example.tar

 

Let's say the following is returned, meaning that example. tar contains two files, foo.txt and bar.txt.

tmp/
tmp/foo.txt
tmp/bar.txt

 

The --delete option can be used to remove files from the tar archive. In this example, bar.txt will be removed.

tar --delete --file example.tar tmp/bar.txt

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 1139dc in the box below so that we can be sure you are a human.