tar: delete
1
1 4.2.5 Removing Archive Members Using '--delete'
1 -----------------------------------------------
1
1 You can remove members from an archive by using the '--delete' option.
1 Specify the name of the archive with '--file' ('-f') and then specify
1 the names of the members to be deleted; if you list no member names,
1 nothing will be deleted. The '--verbose' option will cause 'tar' to
1 print the names of the members as they are deleted. As with
1 '--extract', you must give the exact member names when using 'tar
1 --delete'. '--delete' will remove all versions of the named file from
1 the archive. The '--delete' operation can run very slowly.
1
1 Unlike other operations, '--delete' has no short form.
1
1 This operation will rewrite the archive. You can only use '--delete'
1 on an archive if the archive device allows you to write to any point on
1 the media, such as a disk; because of this, it does not work on magnetic
1 tapes. Do not try to delete an archive member from a magnetic tape; the
1 action will not succeed, and you will be likely to scramble the archive
1 and damage your tape. There is no safe way (except by completely
1 re-writing the archive) to delete files from most kinds of magnetic
1 tape. ⇒Media.
1
1 To delete all versions of the file 'blues' from the archive
1 'collection.tar' in the 'practice' directory, make sure you are in that
1 directory, and then,
1
1 $ tar --list --file=collection.tar
1 blues
1 folk
1 jazz
1 rock
1 $ tar --delete --file=collection.tar blues
1 $ tar --list --file=collection.tar
1 folk
1 jazz
1 rock
1
1 The '--delete' option has been reported to work properly when 'tar'
1 acts as a filter from 'stdin' to 'stdout'.
1