Solved

Tar

Posted on 1997-12-15
1
499 Views
Last Modified: 2010-10-18
When I tar I use the command "tar cvf backup.tar /home/name/dir/ " When I untar I always get the /home/name/dir file structure.  How do I tar a directory and untar into a new file structure without inheriting the previous strucutre.
For example, say I wanted to tar a directory with many files in my home directory, "/home/name/dir" and want to unpack it on another Unix box in "export/home/newdir" How can I unpack the dir files in newdir directory without inheriting the previous file structure beyond newdir.
Plese be specific as possible.  Thanks in advance.
                        dkurry
0
Comment
Question by:dkurry
1 Comment
 

Accepted Solution

by:
Mika_Saari earned 100 total points
ID: 2008353
Hi !

      With dir subdirectory
      Tar:
      1. cd /home/name
       2. tar cvf /tmp/backup.tar dir
      Now the directory is backupped without the
        /home/name prefix

      Untar:
        1. cd /export/home/newdir
       2. tar xvf /tmp/backup.tar
        then the structure will be
      /export/home/newdir/dir

      --------------------------
      If you do not want the dir
      Tar:
      1. cd /home/name/dir
      2. tar cvf /tmp/backup.tar *

      Untar:
      1. cd /export/home
      2. mkdir newdir
      3. cd newdir
      4. tar xvf /tmp/backup.tar            
      

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question