LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 05-21-2007, 10:44 PM   #1
davimint
Member
 
Registered: Jan 2006
Distribution: Slackware Current
Posts: 272

Rep: Reputation: 33
simple tar question can not find answer in man file


Is there anyway to remove or strip the leading directory when extracting a tar file. I didn't see a option or understand it anyway in the man page.

Here's an example of what I would like to do so my question doesn't get confused.

I want to install the "essential-20061022.tar.bz2" for Mplayer in the directory of "/usr/local/lib/codecs/ so
I run the following command
Code:
tar xvjf essential-20061022.tar.bz2 -C /usr/local/lib/codes

Which of course all I did was direct the output of the tar command so I end up extracting the file to /usr/local/lib/codes/essential/

But what I want to do is install the files and strip the leading directory "essential".

Maybe I did not confuse everyone.
 
Old 05-21-2007, 10:53 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Here's a Rube Goldberg method. It might work. But, really if it's just one file what's the fuss?

Code:
ln -s /usr/local/lib/codecs /usr/local/lib/essential
tar xvjf essential-20061022.tar.bz2 -C /usr/local/lib
rm /usr/local/lib/essential

Last edited by Quakeboy02; 05-21-2007 at 10:54 PM.
 
Old 05-21-2007, 11:21 PM   #3
davimint
Member
 
Registered: Jan 2006
Distribution: Slackware Current
Posts: 272

Original Poster
Rep: Reputation: 33
Quakeboy02,
Well, that didn't work. It's the whole dll libary for MPlayer so it's about 20 files and one README. Which it's not a problem to simply mv *.dll the files but I just thought there would be a way to strip the leading directory name inside the tar file so I could direct the files to the proper directory without having to move them. Just trying to learn a trick if there was one.

davimint
 
Old 05-22-2007, 01:03 AM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Linux 11 (Bullseye)
Posts: 3,407

Rep: Reputation: 141Reputation: 141
Hmm, I thought it might. What exactly didn't it do?

A second way, which I would probably use myself unless I was short on disk space and it was an extremely large tar file, would be to create a junk directory, untar to that. Go into the "essential" directory, and create a new tar file from there.

There are usually better ways to do things than what I come up with, but I'm a brute force kinda guy. I prefer to bang it with successively larger sticks till it works!
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Ubuntu Fluxbox simple question, simple answer? generallimptoes Linux - Software 3 09-26-2005 02:03 PM
Simple Gimp Question, but I can't find answer Mic Q SUSE / openSUSE 2 12-30-2004 12:59 PM
Xterm question (simple for non-newbies to answer) dhrivnak Linux - General 6 11-04-2003 05:45 PM
what should a man do to take a f.... answer for a question? geminyn_1981 Linux - Newbie 7 01-13-2003 04:51 PM
simple question seeking simple answer enzo250gto Linux - Newbie 1 10-27-2001 04:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:43 AM.

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
Open Source Consulting | Domain Registration