How to untar without first knowing the tar contents?
On Thu, Feb 25, 2010 at 10:18 AM, Florian Philipp
> Mark Knecht schrieb:
>> * *I backed up my wife's home directory using tar in preparation to
>> moving her to a new machine but I don't remember the exact command I
>> used to do the tar command. When I tried to untar on the new machine
>> it failed to do anything. (except use 30 minutes of CPU time...)
>> MacMini home # tar -xjf /mnt/cdrom/evelyn.20100214.tar.bz2 /home/evelyn/
>> tar: /home/evelyn: Not found in archive
>> tar: Error exit delayed from previous errors
>> MacMini home #
>> I'm currently running
>> tar -tz /mnt/cdrom/evelyn.20100214.tar.bz2
>> and it's been going 15 minutes without writing anything to the screen.
>> I assume that I need to list the contents of the tar file to figure
>> out how to untar but I'm really not sure.
>> * *How do I best proceed?
> Err, your tar commands are a bit wrong.
> tar -xjf /mnt/cdrom/evelyn.20100214.tar.bz2 /home/evelyn/
> tells tar to extract the parts of it which are under home/evelyn to the
> working directory.
> This might be what you wanted in the first place but I guess you rather want
> tar -xjf /mnt/cdrom/evelyn.20100214.tar.bz2 -C /home/evelyn/
> which means extracting the complete content of the tar file to /home/evelyn.
> Your second command ... well, where to start:
> 1. Since you didn't use the -f switch (as you did correctly in the first
> command), tar expects input from stdin, not as a file specified on
> commandline. That's why it hasn't done anything in the last 15 minutes.
> 2. With -z you specify that the file is compressed with gzip but the
> file ending shows its compressed with bzip2. That's the -j switch
> (again, correct in your first command).
> By the way: You should enable the -p switch when extracting the files in
> order to restore permissions and so forth.
> Hope this helps!
> Florian Philipp
Wow! I'm really bad! I didn't get that about stdin at all. Never
dawned on me... Stupid me...