Unix / Linux: Tar Command Remove a Directory From a Tar Ball

by on January 20, 2010 · 0 comments· last updated at September 20, 2011

How do I remove a directory from a tar ball under Unix / Linux operating systems?

The syntax to remove a directory from a tar ball is as follows:

 
tar --delete -f file.tar 'path1/dir1'
 

OR

 
tar --delete -f file.tar 'dir1'
 

To delete a directory called etc/security from a foo.tar, enter:
$ tar --delete -f foo.tar 'etc/security'
Verify that directory has been deleted from the foo.tar ball, enter:
$ tar -tvf foo.tar | less
OR
$ tar -tvf foo.tar | grep 'etc/security'



You should follow me on twitter here or grab rss feed to keep track of new changes.

Featured Articles:

{ 0 comments… add one now }

Leave a Comment

You can use these HTML tags and attributes for your code and commands: <strong> <em> <ol> <li> <u> <ul> <kbd> <blockquote> <pre> <a href="" title="">

Tagged as: , , , , , , ,

Previous Faq:

Next Faq: