HowTo extract from a tar archiv ...

HowTo extract from a tar archiv ...

Post by Markus Men » Sun, 29 Aug 1999 04:00:00



Quote:> Hey and hello,

> I do have a tar archive on a tape. I would like to extract some files
> onto my solaris machine. However all the files on the archive are
> in absolute path notation...Is there a switch to tell the tar cmd
> not to try to restore with the absolute path notation, since I don't
> want those pathes on my solaris box ??

> thank's

> marcus

> --

--
********************************************************************
** Meng Engineering        Telefon    056 222 44 10               **
** Markus Meng             Natel      079 230 93 86               **
** Bruggerstr. 21          Telefax    056 222 44 10               **

********************************************************************
 
 
 

HowTo extract from a tar archiv ...

Post by Leonard Even » Sun, 29 Aug 1999 04:00:00



> > Hey and hello,

> > I do have a tar archive on a tape. I would like to extract some files
> > onto my solaris machine. However all the files on the archive are
> > in absolute path notation...Is there a switch to tell the tar cmd
> > not to try to restore with the absolute path notation, since I don't
> > want those pathes on my solaris box ??

> > thank's

> > marcus

> > --

> --
> ********************************************************************
> ** Meng Engineering        Telefon    056 222 44 10               **
> ** Markus Meng             Natel      079 230 93 86               **
> ** Bruggerstr. 21          Telefax    056 222 44 10               **

> ********************************************************************

This is really a question about Solaris, not Linux.   But check
the man page for chroot

chroot newroot "tar xvf ..."

or some variation should do it.
--


Dept. of Mathematics, Northwestern Univ., Evanston, IL 60208

 
 
 

HowTo extract from a tar archiv ...

Post by Leonard Even » Mon, 30 Aug 1999 04:00:00



> I'm not sure I understand fully. Tar by itself, with no added command
> line parameter will not do absolute-path, so if you <tar xvf
> filename.tar> it will untar the archive in the pwd. It should only be
> when you do a <tar xvf --absolute-path filename.tar> that it will
> cause it to untar in the incorporated paths. Or am I confused?
> chris

> On Sat, 28 Aug 1999 10:13:35 +0200, "Markus Meng"

> >> Hey and hello,

> >> I do have a tar archive on a tape. I would like to extract some files
> >> onto my solaris machine. However all the files on the archive are
> >> in absolute path notation...Is there a switch to tell the tar cmd
> >> not to try to restore with the absolute path notation, since I don't
> >> want those pathes on my solaris box ??

> >> thank's

> >> marcus

> >> --

> --
> Chris Campbell

> http://members.xoom.com/tech33/
> Tech33 on the IRC

If you think about it a moment, you will realize that the filename
can't just be a name of a file.  After all, you could have the
same filename in different directories.  So if you are extracting
a specific file, you have to give its complete path specification
as listed in the tar archive.   If it is a relative path, tar
will extract just that path relative to the current directory.
But if it is an absolute path, it will try to do it from /.
Having said that, I must admit I haven't tried that with
an absolute path since the first time many years ago when
I first ran into trouble for so doing.  Old Unix hands NEVER
use absolute paths in tars unless they have a compelling
reason.

--


Dept. of Mathematics, Northwestern Univ., Evanston, IL 60208

 
 
 

HowTo extract from a tar archiv ...

Post by Mark P. Nelso » Thu, 02 Sep 1999 04:00:00


: I'm not sure I understand fully. Tar by itself, with no added command
: line parameter will not do absolute-path, so if you <tar xvf
: filename.tar> it will untar the archive in the pwd. It should only be
: when you do a <tar xvf --absolute-path filename.tar> that it will
: cause it to untar in the incorporated paths. Or am I confused?
: chris

You are confusing GNU tar with common (or garden) tar.

Using a regular, unenhanced tar, untarring an archive that has been
created using something not too clever, like 'tar cf /dev/st0 /usr/bin'
will give you something that will _always_ untar to /usr/bin, because
of the leading slash in all the filenames, and it does't matter what
directory you are in when you try to untar it.

This is why you should always do something like this instead:

'cd / && tar cf /dev/st0 usr/bin'

Fortunately for the original poster, GNU tar will automatically strip
leading slashes off pathnames in stupidly created archives (unless you
tell it not to).  SO, if your Solaris box comes with some other version
of tar, you should dump it and get GNU tar instead--problem solved.

HTH.

--
Mark P. Nelson, Programmer/Analyst
Department of Integrative Biology, Thomson Laboratory
Clotho, Lachesis, Atropos         --         the only sysadmins that matter

 
 
 

1. tar question: how do I extract some files without extracting directories

For example, if I have foo.tar.gz consisting of:

foo/
    bar/
      baz/
        file1.png

What (GNU) tar options do I have to use to extract the file 'file1.png'
to ~/tmp without the directory hierarchy 'foo/bar/baz'?

Something like:

   $ tar zx ~/tmp/file1.png f foo.tar.gz   #This does not work...

Should produce:

~/tmp/
    file1.png

Any thoughts?

TIA,

    Erik.

2. 7235 POWER Gto graphics, refresh setting ?

3. tar question: how do I extract some files without extracting directories.

4. Is this program secure?

5. Extracting files with tar and uncompress fails with tar: Archive - EOF not on block boundary

6. NEC external CDrom changer

7. Archiv with tar --> Problem Option "T"

8. Mozilla 1.0 under solaris 2.7

9. Extracting files from multivolume tar archive made with SCO tar

10. using tar command to extract tarred files

11. defektes tar-archiv

12. extracting majordomo with tar

13. extracting tar.Z