LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-11-2019, 01:11 PM   #1
200mg
Member
 
Registered: Jul 2006
Posts: 86

Rep: Reputation: 15
Noob untar Question


My tar has Directory paths, if i do a tar -tvf it shows the dir paths and the files. Every tar -x*** that I run untars to the current path and I know -C will set a path, but my tar has MANY paths in it, how can i untar to the path defined in the tar?
 
Old 02-11-2019, 01:21 PM   #2
tyler2016
LQ Newbie
 
Registered: Sep 2018
Distribution: Debian, CentOS, FreeBSD
Posts: 14

Rep: Reputation: Disabled
Maybe you want to run tar from /? By default, tar strips leading /s when you create tar files. You can override this behavior in the GNU version with -P. This can overwrite files so be sure it is really what you want to do. You can prevent overwriting with -k.

Last edited by tyler2016; 02-11-2019 at 01:23 PM.
 
Old 02-11-2019, 07:58 PM   #3
mrmazda
Senior Member
 
Registered: Aug 2016
Location: USA
Distribution: openSUSE, Debian, Knoppix, Mageia, Fedora, others
Posts: 1,111

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
One way is to use a file manager that permits "entry" to the the archive, then copying files or directories directly to the FM's destination pane. OFM's I'm familiar with all include this facility, one of which is Midnight Commander (MC), available in most distros' standard repos.
 
Old 02-12-2019, 08:23 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: MA, USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 7,367
Blog Entries: 12

Rep: Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880Reputation: 2880
Quote:
Originally Posted by 200mg View Post
My tar has Directory paths, if i do a tar -tvf it shows the dir paths and the files. Every tar -x*** that I run untars to the current path and I know -C will set a path, but my tar has MANY paths in it, how can i untar to the path defined in the tar?
Nearly every tar file I extract has many paths in it.

What's your point here?

By this I mean: Very typically, someone archives something, and usually a hierarchy such as a software repository, a set of data files for their machine, a tree of files or documents from a system, a package and associated files which reside on a system. And all that starts from a top level directory.

Some options are to only extract certain files using a filter, or to create a sub-directory solely for the extraction. You have the report, so you know what will come out of it. You can put the extracted files into a sub-directory, if not already would be done by an extraction, and then move them to wherever you wish.

I don't bother with the -C option, you can always just cd to the target directory and run the tar command from there.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
A noob in need is a noob indeed Ryuji Yamazaki *BSD 3 10-28-2004 09:19 PM
noob with a noob question phoonerorlater Linux - Newbie 2 09-29-2004 04:43 PM
3 Noob Quetions From A Noob DaveyB Slackware 20 08-11-2004 09:00 PM
Firewall help (noob really really huge noob) ProtoformX Linux - Networking 1 03-29-2004 01:19 AM
Complete noob question from a noob noob_hampster Linux - Software 2 09-04-2003 01:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration