Solved

Tar

Posted on 1997-12-15
1
504 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

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

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…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

717 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