Solved

Tar

Posted on 1997-12-15
1
485 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
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 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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

743 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now