LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-01-2006, 04:49 PM   #1
Corrado
Member
 
Registered: Aug 2004
Location: Washington
Distribution: RHEL
Posts: 174

Rep: Reputation: 16
Using tar


I have been trying to extract something in tar and it isn't putting it in the location I want.

How do I extract a tar file in one directory and place its contents into another directory??

I am trying to place this command into a bash script.

Lets say my pwd is /, tar file is in /usr.
From / I want to extract the tar file in /usr to /usr/local

Anyone know how to do this? The man pages aren't helping.

Chris
 
Old 11-01-2006, 05:09 PM   #2
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Code:
cd /usr/local
tar -xpf /usr/file.tar
or
Code:
tar -C /usr/local -xpf /usr/file.tar
I'm not going to test that. It should work.
 
Old 11-01-2006, 07:03 PM   #3
Corrado
Member
 
Registered: Aug 2004
Location: Washington
Distribution: RHEL
Posts: 174

Original Poster
Rep: Reputation: 16
The second one seems to work. Thanks.
 
  


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
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
problem unzipping a tar.bz2 file tar: Error is not recov jyome Linux - Software 4 09-04-2003 01:04 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 - General

All times are GMT -5. The time now is 03:48 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
Open Source Consulting | Domain Registration