Gentoo Archives: gentoo-user

From: Florian Philipp <lists@××××××××××××××××××.net>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How to untar without first knowing the tar contents?
Date: Thu, 25 Feb 2010 18:25:12
Message-Id: 4B86BF10.7080803@f_philipp.fastmail.net
In Reply to: [gentoo-user] How to untar without first knowing the tar contents? by Mark Knecht
1 Mark Knecht schrieb:
2 > Hi,
3 > I backed up my wife's home directory using tar in preparation to
4 > moving her to a new machine but I don't remember the exact command I
5 > used to do the tar command. When I tried to untar on the new machine
6 > it failed to do anything. (except use 30 minutes of CPU time...)
7 >
8 > MacMini home # tar -xjf /mnt/cdrom/evelyn.20100214.tar.bz2 /home/evelyn/
9 > tar: /home/evelyn: Not found in archive
10 > tar: Error exit delayed from previous errors
11 > MacMini home #
12 >
13 > I'm currently running
14 >
15 > tar -tz /mnt/cdrom/evelyn.20100214.tar.bz2
16 >
17 > and it's been going 15 minutes without writing anything to the screen.
18 > I assume that I need to list the contents of the tar file to figure
19 > out how to untar but I'm really not sure.
20 >
21 > How do I best proceed?
22 >
23 > Thanks,
24 > Mark
25 >
26
27 Err, your tar commands are a bit wrong.
28
29 tar -xjf /mnt/cdrom/evelyn.20100214.tar.bz2 /home/evelyn/
30 tells tar to extract the parts of it which are under home/evelyn to the
31 working directory.
32 This might be what you wanted in the first place but I guess you rather want
33 tar -xjf /mnt/cdrom/evelyn.20100214.tar.bz2 -C /home/evelyn/
34 which means extracting the complete content of the tar file to /home/evelyn.
35
36 Your second command ... well, where to start:
37 1. Since you didn't use the -f switch (as you did correctly in the first
38 command), tar expects input from stdin, not as a file specified on
39 commandline. That's why it hasn't done anything in the last 15 minutes.
40
41 2. With -z you specify that the file is compressed with gzip but the
42 file ending shows its compressed with bzip2. That's the -j switch
43 (again, correct in your first command).
44
45 By the way: You should enable the -p switch when extracting the files in
46 order to restore permissions and so forth.
47
48 Hope this helps!
49 Florian Philipp

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-user] How to untar without first knowing the tar contents? Mark Knecht <markknecht@×××××.com>