LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 04-04-2006, 12:38 PM   #1
Linux_Lite
LQ Newbie
 
Registered: Nov 2005
Posts: 8

Rep: Reputation: 0
How do I use the tar command to extract to a particular folder



Hi guys
Can you help out with this problem?

Is it possible to extract a tar file to a specific directory
e.g. tar xvf somefile.tar to /somerootfolder

Thanks to anyone who replies.
LL
 
Old 04-04-2006, 12:49 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392Reputation: 2392
Hi,

cd /somerootfolder
tar xf /path/to/somefile.tar


Hope this helps
 
Old 04-04-2006, 12:49 PM   #3
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 272Reputation: 272Reputation: 272
tar -C /some/root/folder -xvf somefile.tar
 
Old 04-05-2006, 03:12 AM   #4
Linux_Lite
LQ Newbie
 
Registered: Nov 2005
Posts: 8

Original Poster
Rep: Reputation: 0


Thanks guys. Both worked but I'm going to go with pljvaldez.
Appreciate the help.
 
Old 04-05-2006, 06:10 AM   #5
Linux_Lite
LQ Newbie
 
Registered: Nov 2005
Posts: 8

Original Poster
Rep: Reputation: 0
is it possible to put limit on tar tvf


Instead of creating a new thread I thought I would ask here.

I'm using the command tar -tvf myarchive.tar to view the contents of a tar archive. The problem is that it takes too long to list out each file in the archive.

I tried to using tar -tvf myarchive.tar | more but its not really what I want.

Is there any way to limit there number of files which are displayed?
Thanks
LL
 
Old 04-05-2006, 12:29 PM   #6
pljvaldez
LQ Guru
 
Registered: Dec 2005
Location: Somewhere on the String
Distribution: Debian Wheezy (x86)
Posts: 6,094

Rep: Reputation: 272Reputation: 272Reputation: 272
If you're looking for some particular file, you can tar -tvf myarchive.tar | grep keyword which will only show the lines with "keyword" in them.
 
Old 04-05-2006, 03:02 PM   #7
DotHQ
Member
 
Registered: Mar 2006
Location: Ohio, USA
Distribution: Red Hat, Fedora, Knoppix,
Posts: 548

Rep: Reputation: 33
...or you could pipe it to head or tail.
ie: tar -tvf somefile.tar | head 500

will give you the first 500 lines. Tail works the same way in that tail 500 would give you the last 500 lines

------
or just redirect it to a file ie:
tar -tvf > /tmp/newfilename
will create a file called newfilename which consists of a listing of your tar file.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to extract mutiple tar.gz int21h Linux - Newbie 14 12-08-2005 07:58 AM
using tar to extract properly xushi Slackware 9 03-05-2005 10:10 AM
How to extract a tar.gz file? deWin Linux - Newbie 3 11-10-2004 12:24 PM
tar extract fails dgermann Linux - Newbie 8 08-28-2004 12:26 PM
Choosing where to extract tar.gz Arclite Linux - Software 14 08-14-2003 04:57 PM

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

All times are GMT -5. The time now is 06:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration