LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 10-19-2007, 03:27 PM   #1
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Rep: Reputation: 31
How to manage .tgz files?


Is it possible to view just the directories that I backed up? not the whole path? for example:

DataHD/projects/adc/adc002_Hard_Launch/dt/html module prototypes/OfficeLocator/trunk/images/_svn/prop-base/

i just want to see the main directories inside the projects directory such as /adc NOT the whole path. I have around 20 of these. Also is there a way to extract just a particular folder/file from that .tgz file? thanks
 
Old 10-20-2007, 07:06 AM   #2
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
Try:
tar -tvzf | cut -f 2 -d /
 
Old 10-23-2007, 12:18 PM   #3
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
I don't get to see anything, I only get the DataHD/ directory.
 
Old 10-23-2007, 12:24 PM   #4
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
Quote:
Originally Posted by cucolin@ View Post
is there a way to extract just a particular folder/file from that .tgz file? thanks
Yes, use the --extract option. See:

man tar

-----------------
Steve Stites
 
Old 10-23-2007, 01:20 PM   #5
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
Quote:
Originally Posted by cucolin@ View Post
I don't get to see anything, I only get the DataHD/ directory.

Sorry it is:

cut -f 3 -d \/

in your case.
This will you the third field

Or even better:

cut -f 3 -d \/ | sort -u
 
Old 10-23-2007, 10:41 PM   #6
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
thanks guys! I wanted to ask you if there is a file size limitation for tar, I'm tarring a 250GB folder to an external HD, but the tar does not complete maybe only a 1/4 of the total size. thanks again!
 
Old 10-24-2007, 03:11 AM   #7
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
Tar does not seem to have a file SIZE limit but it does have a file AMOUNT limit. That is, if the list is too long tar will quit.
I don't know what the max file list is.
 
Old 10-25-2007, 01:19 PM   #8
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
gerben12, I'm using your command and it works, but I have around 30 folders which are the ones I want to view, for example:

DataHD/folder1/
DataHD/folder2/
DataHD/folder3/

with your command I'm able to see the folders I want to see, but in this fashion:

folder1/
folder1/
folder1/ (and it repeats for around 2 minutes then it goes to folder2/ and so on)

is there a way to view them in order? folder1 then folder2 then folder3.......folder30.

when I try: cut -f 3 -d \/ | sort -u
I get nothing. It stays frozen until I press Crtl+C

Thanks

Last edited by cucolin@; 10-25-2007 at 02:17 PM.
 
Old 10-25-2007, 02:20 PM   #9
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
Hi,

Like I said:

Put:

tar -tvzf | cut -f 3 -d \/ | sort -u

behind it

Then you will see every dir only once.
 
Old 10-25-2007, 02:37 PM   #10
cucolin@
Member
 
Registered: Nov 2003
Location: USA
Distribution: Ubuntu, CentOS, RedHat
Posts: 416

Original Poster
Rep: Reputation: 31
thanks gerben12, but I already did that as I explained above. Apologies if I didn't explain myself well. thanks!
 
Old 10-25-2007, 02:48 PM   #11
gerben12
LQ Newbie
 
Registered: Oct 2007
Distribution: SuSE, Redhat, Debian
Posts: 25

Rep: Reputation: 15
My fault too. I didnt read well.

Well it will remain frozen untill it gets to the next dir inyour tar file, bcause it isstill in the same directory and busy viewing the tar file.

I guess it will show the next dir after the 2 minutes you waited before.

Try and redirect the output to a file

.... | sort -u > /tmp/file.txt
cat /tmp/file.txt

My guess is you will see your dirs.

Besides that, I dont know if you also have any files in you "upper" dirs, but they will show too.
Havent figured out yethow to avoid those...

Last edited by gerben12; 10-25-2007 at 02:55 PM.
 
  


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
when .tgz files are downloaded they turn into .tar files?!?! Flz Slackware 10 12-20-2005 02:32 PM
.tgz files mohapi Linux - General 2 05-03-2003 10:11 AM
tgz files moger Slackware 10 10-05-2002 01:29 AM
tgz files Chijtska Linux - General 1 02-07-2002 01:44 PM
.tgz files philfighter Linux - Newbie 6 08-22-2001 02:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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