[CentOS] tar question

Les Mikesell lesmikesell at gmail.com
Sat Sep 3 17:04:18 UTC 2005

On Sat, 2005-09-03 at 11:05, Todd Cary wrote:
> Basic tar question:
> I have created a ar file with
> tar -prvf /tmp/ib_backup.tar /opt/interbase/data/*

> The file has been copied to another box and I want to untar the file into
> /opt/interbase/data/
> I am not sure about the syntax; how to specify where I want the data to 
> be placed.
> Here is my start of the command:
> tar -xvf /tmp/ib_backup.tar                   #The tar file is in /tmp

You created the file with the full path starting from /.  Gnutar
will default to removing the leading / (to prevent some really
stupid things from happening...) and installs under your current
directory.  So, if you want it back under the same path, cd to
/ before you extract.  If you aren't sure, look at the contents
with 'tar -t' first to see how the paths look relative to your
current directory.  There are also options to tar to keep the
leading / or to change directories before doing an operation
but I think it is less confusing to just cd to the right place
before running the command.

  Les Mikesell
    lesmikesell at gmail.com

More information about the CentOS mailing list