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...
OK, using Neil's suggestion
tar tfv archivername
results in the first few lines:
MacMini ~ # tar tvf /mnt/cdrom/evelyn.20100214.tar.bz2
drwx------ evelyn/users 0 2010-02-13 14:50 home/evelyn/
drwx------ evelyn/users 0 2008-04-11 17:33 home/evelyn/.AbiSuite/
-rw-r--r-- evelyn/users 2614 2008-07-24 01:18
drwxr-xr-x evelyn/users 0 2010-02-12 19:21 home/evelyn/.xine/
drwxr-xr-x evelyn/users 0 2007-09-19 13:36 home/evelyn/.xine/cddbcache/
-rw-r--r-- evelyn/users 761 2007-09-19 13:36 home/evelyn/.xine/cddbcache/5e0
so I tried
tar xfv /mnt/cdrom/evelyn.20100214.tar.bz2 -C /
and because /home/evelyn already exists the files seemed to end up in
the right place.
|All times are GMT. The time now is 08:00 AM.|
VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.