LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-10-2005, 01:32 PM   #1
thick_guy_9
Member
 
Registered: Jan 2004
Location: Singapore
Distribution: VMS, CentOS
Posts: 109

Rep: Reputation: 16
tar help - how to tar to a different directory


guys,
I am having problem with tar.

I have a lot of mplayer skins in .gz format, that I need to extract to /usr/local/share/mplayer/Skins. Given that these *.gz files are in /home/sw, how do I get tar to extract them to /usr...?

I know i need to loop, but do not know the tar switches....


for i in `ls *.gz`
do
tar -xvzf $i -------------------------------> I need help here...
done

bye
 
Old 03-10-2005, 01:35 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Start from the dir you want to extract to.

Code:
cd /usr/local/share/mplayer/Skins
for i in `ls /path/to/*.gz`
do
tar -xvzf $i
done
Hope this helps.
 
Old 03-10-2005, 04:35 PM   #3
or1onas
Member
 
Registered: Mar 2004
Location: Athens,Greece
Distribution: Mint
Posts: 181

Rep: Reputation: 32
You can also add the parameter '--directory=<path>' to tar in order to send the extracted files there.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 02:48 AM
tar tar cvf - . | (cd /root/; tar xvf -) ewt3y Linux - General 10 02-19-2014 10:55 AM
a tough question 4 u, problem in extracting tar & tar.gz files p_garg Linux - General 5 11-08-2010 11:02 AM
.rpms, .tar.gz, .tgz, .src.rpm, & .tar.bz2 whoots Mandriva 10 10-18-2003 12:08 PM
Diferance between rpm, tar, tar.gz, scr.tar, etc mobassir Linux - General 12 08-21-2003 06:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:04 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