cli-tarHow do I remove a file from a Unix tar archive?
To remove a file from a Unix tar archive, you can use the tar --delete
command. The syntax for this command is tar --delete <archive> <filename>
. For example, to delete the file file.txt
from the archive archive.tar
, you would use:
tar --delete archive.tar file.txt
The command will delete the file from the archive and print a message like the following:
tar: Deleting file `file.txt' from archive `archive.tar'
The parts of the command are as follows:
tar
: The command to use for manipulating tar archives--delete
: The flag to indicate that you want to delete a file from the archivearchive.tar
: The name of the tar archivefile.txt
: The name of the file to delete from the archive
For more information on the tar --delete
command, see the manual page here.
More of Cli Tar
- How can I use tar commands to zip a file?
- How do I use the command line to tar and zip files?
- How do I use gzip, tar, and zip to compress files?
- How do I use the command line to tar and zip a file?
- How do I use the shell to tar and zip files?
- How do I use the Unix tar zip command?
- How do I create a tar.zip file in Unix?
- How do I use the command line to tar and zip a file?
- How do I use the command line to tar and distribute files?
- How do I use the Unix tar xvf command to extract files?
See more codes...