Solved

Tar

Posted on 1997-12-15
1
496 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
netstat -a in AIX unix 8 43
Where to get php 5.6 for AIX 7.1? 5 102
Solaris 4.1.3 cloning and booting 13 79
SCP a file to multiple machines using a script 4 45
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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…
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…

809 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