The –delete option allows specified files to be completely removed from a tar file (except when the tar file is on magnetic tape). However, this is different from an extraction, as copies of the removed files are not made and placed in the current directory. Thus, for example, the files file1 and file2 can be removed from file.tar with the following:

tar -f file.tar --delete file1 file2

To remove a directory dir1:

tar -f file.tar --delete dir1/*

The -t option tells tar to list the contents of an uncompressed archive without performing an extraction. Thus, the following would list the contents of file.tar:

tar -tf file.tar

By |2009-02-18T02:30:00-05:00February 18th, 2009|Development, Linux|