LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-17-2006, 06:57 AM   #1
madhugp
LQ Newbie
 
Registered: May 2006
Posts: 20

Rep: Reputation: 0
Question reading or deleting file from tar backup


hi friends, can we delete a perticualr file from
catridge. The catridge is having tar backup using
tar commnad. also how to find a perticualar file
existing in tar backup of catridge.

thanks
 
Old 10-17-2006, 08:20 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
To see if a file exists in a tar archive, you could use the t command. For example to see if the file data/files/myfile exists in the tarfile file.tar you could do this:

Code:
tar tvf file.far data/files/myfile
You might also employ grep to look for any files whose name contains the text "myfile" (note grep is case sensitive unless you specify the -i option):

Code:
tar tvf file.tar |grep myfile
You can delete files from a tar archive using the --delete option, but this is not for use with tapes - just if you are using tar files as a container format (e.g. for distribution of groups of files).

I recommend you take a look at the tar tutorial for more information, not to mention the manual and infotex pages which most likely are installed on your linux system. To access these, just type "man tar", and "info tar".
 
Old 10-17-2006, 08:43 AM   #3
muslim
LQ Newbie
 
Registered: Oct 2006
Distribution: arabian
Posts: 11

Rep: Reputation: 0
Hello!

You can use an easy program like Ark or Karchiver. If you want to use the command line the command is:
Code:
tar --delete --file=archiv.tar the_file_name
For more info write tar --help or look at gnu tar manual.

Last edited by muslim; 10-17-2006 at 08:46 AM.
 
Old 10-17-2006, 09:42 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
Exclamation

Quote:
Originally Posted by muslim
You can use an easy program like Ark or Karchiver. If you want to use the command line the command is:
Code:
tar --delete --file=archiv.tar the_file_name
For more info write tar --help or look at gnu tar manual.
IMPORTANT NOTE from the tar info page (emphasis mine):

Quote:
This operation will rewrite the archive. You can only use `--delete' on an archive if the archive device allows you to write to any point on the media, such as a disk; because of this, it does not work on magnetic tapes. Do not try to delete an archive member from a magnetic tape; the action will not succeed, and you will be likely to scramble the archive and damage your tape. There is no safe way (except by completely re-writing the archive) to delete files from most kinds of magnetic tape.
i.e. don't do it on a tar archive which is on a tape drive.
 
Old 10-18-2006, 02:30 AM   #5
muslim
LQ Newbie
 
Registered: Oct 2006
Distribution: arabian
Posts: 11

Rep: Reputation: 0
Thank you for noting!

Last edited by muslim; 10-18-2006 at 02:31 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
How can I decrypt a tar.gz.bf BACKUP FILE? I have the password. Balarabay1 Linux - Software 4 10-02-2006 12:42 PM
Deleting unwanted files from any directory without reading each Karthikeyan Gurusamy Linux - Newbie 3 12-24-2005 01:48 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 03:15 AM
large tar backup file to be burn stefane321 Linux - General 2 07-01-2004 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration