Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] How to extract archive to original path?

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
johnywhy
Posts: 21
Joined: 2011-11-24 00:17

[Solved] How to extract archive to original path?

#1 Post by johnywhy »

How to extract an archive to its original path?

When i create a tar file, it doesn't seem to include paths.
When i extract it, it doesn't go to its original path, it just goes to the current directory.

Code: Select all

# tar -cf here.tar here
# tar -tvf here.tar 
-rw-r--r-- root/root         0 2018-09-04 12:05 here
Last edited by johnywhy on 2018-09-11 13:07, edited 1 time in total.

User avatar
GarryRicketson
Posts: 5644
Joined: 2015-01-20 22:16
Location: Durango, Mexico

Re: How to extract archive to original path?

#2 Post by GarryRicketson »

Code: Select all

man tar
-C directory
This is a positional argument which sets the working directory
for the following files. When extracting, files will be
extracted into the specified directory; when creating, the
specified files will be matched from the directory.

Code: Select all

tar -xf archive.tar -C /target/directory 
If the target directory does not exist, it must be created first.

Or, for detailed explanations, and examples , do this:
How to extract a tar archive to original path?

johnywhy
Posts: 21
Joined: 2011-11-24 00:17

Re: [Solved] How to extract archive to original path?

#3 Post by johnywhy »

Thx, Garry!

Post Reply