LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-06-2004, 02:44 AM   #1
merlin23
Member
 
Registered: Dec 2004
Location: Vienna
Posts: 46

Rep: Reputation: 15
Unhappy How to list the files in my tar.bz2 archive ???


Hi!
Does anyone know why the following command isn't working : tar -tj myarchive.tar.bz2 ???

the -t option is for list and the -j option is for filter through bzip2 ...

but when I type this command, nothing seems to happen...
 
Old 12-06-2004, 03:08 AM   #2
ritme909
Member
 
Registered: Nov 2004
Location: Washington DC
Distribution: Debian, LFS, FC2
Posts: 43

Rep: Reputation: 15
You need an f as in "file" in there. So tar -tjf myarchive.tar.bz2 should work. Hope this helps.
 
Old 12-06-2004, 03:22 AM   #3
merlin23
Member
 
Registered: Dec 2004
Location: Vienna
Posts: 46

Original Poster
Rep: Reputation: 15
thx very much, that worked...
I have a little other question: is it possible to extract just a few files from the archive?
It is an archive of many gigs and I just need a few files from it...
 
Old 12-06-2004, 03:34 AM   #4
ritme909
Member
 
Registered: Nov 2004
Location: Washington DC
Distribution: Debian, LFS, FC2
Posts: 43

Rep: Reputation: 15
The easiest way to do this is with a front-end, something like File Roller. If this isn't an option you could do something like 'tar -xfvj foo.tar.bz2 fileinarchive.c anotherfile.c" if you want to extract fileinarchive.c and anotherfile.c from foo.tar.bz2. You can also use wild-cards like 'tar -xfvj foo.tar.bz2 *.c'
 
Old 12-06-2004, 07:03 AM   #5
merlin23
Member
 
Registered: Dec 2004
Location: Vienna
Posts: 46

Original Poster
Rep: Reputation: 15
no, it isn't really a good alternative, because my maschine is very slow and space is not much...
I tried your command and like this:

tar -xfvj SystemBackup.tar.bz2 usr/local/var/htdig

where usr/local/var/htdig is my directory, I want to extract..

I got following error:

tar: vj: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now

What went wrong? I tried also with a "/" at the beginning of my path.
 
Old 12-06-2004, 07:15 AM   #6
merlin23
Member
 
Registered: Dec 2004
Location: Vienna
Posts: 46

Original Poster
Rep: Reputation: 15
ok, so far I checked this out, the error does not apear anymore when I pu the f as last argument.

But if I use this command, can't I specify a destination dir?
Is it overwriting my original-files??
 
Old 12-06-2004, 10:39 AM   #7
ritme909
Member
 
Registered: Nov 2004
Location: Washington DC
Distribution: Debian, LFS, FC2
Posts: 43

Rep: Reputation: 15
Oh yeah sorry, guess I typed it out of order. And yes it does just extract it to the working directory. I guess if you want it to extract to another directory just go to that directory and run tar from there. So you could do 'tar -xvjf /path/to/tar/foo.tar.bz2 /directory/in/tar' in the directory you want to extract to.
 
Old 12-06-2004, 11:29 AM   #8
PeteHeyes
LQ Newbie
 
Registered: Dec 2004
Location: Preston, UK
Distribution: Mandrake 10.1
Posts: 8

Rep: Reputation: 0
alternative: use bloat

I find the command line syntax to tar all a bit confusing/difficult to remember, and found a small package called bloat instead.

This will extract all common archives simply by typing
Code:
bloat <file>
Its early days, but it hasn't failed yet...

It can be easily installed via urpmi or from http://bloat.sourceforge.net/ . The only dependancy is bc
 
Old 12-06-2004, 04:16 PM   #9
Dave2
LQ Newbie
 
Registered: Dec 2004
Location: Bath, England
Posts: 3

Rep: Reputation: 0
Bloat...

Just a quick clarification:
Bloat, at very basic, depends on Perl, cat, and file. Of course, if you want it to be useful, you'll need some extractors - see http://bloat.sourceforge.net/requirements.php for details. "bloat --check" will tell you what you don't have.

It's been quite a few months since the release of Bloat 1.4; 1.5 should be out soon, I'm basically waiting on a couple of translations. There's been a few bug fixes, etc, since 1.4. If you're happy with using CVS, it tends to be fairly stable. I don't intentionally commit broken code. But if you feel a bit iffy using the CVS version, just install 1.4 and wait a bit for 1.5 to come out.
 
Old 12-06-2004, 04:48 PM   #10
PeteHeyes
LQ Newbie
 
Registered: Dec 2004
Location: Preston, UK
Distribution: Mandrake 10.1
Posts: 8

Rep: Reputation: 0
Whoops -sorry

See previous post...

I should have said that for my -bog standard - mandrake 10.1C install the only uninstalled dependancy was bc.

I'm still getting away from the Windoze - 'you will be given what we insist you have' mentaility. One day soon I'll begin to remember that 'not all Linux installations are created equal: just better.'

Thanks for clarifying Dave2. And thanks for bloat...

Apologies for any confusion caused..........
 
Old 12-06-2004, 06:20 PM   #11
Dave2
LQ Newbie
 
Registered: Dec 2004
Location: Bath, England
Posts: 3

Rep: Reputation: 0
Glad you find bloat useful

I'm wondering where the bc dependency is coming from - I'm pretty sure my RPMs don't have it in their deps (it depends on /usr/bin/perl, /usr/bin/env, and that's it for the RPM), and bc isn't used by bloat itself anywhere.

(Going offtopic a bit, so might want to take it into PMs or e-mail if it's more than one reply.)
 
Old 12-07-2004, 11:20 AM   #12
PeteHeyes
LQ Newbie
 
Registered: Dec 2004
Location: Preston, UK
Distribution: Mandrake 10.1
Posts: 8

Rep: Reputation: 0
Whoops (2)

God I'm an idiot.

bc must have been the dependency for something else I installed

I have a major case of 'oeuf-sur-le visage' as the French might say

I do reserve the right to continue to ask stupid questions but will refrain from giving stupid 'answers'' until I have at least half a clue what I'm talking about. It could be sometime.

Apologies (again) to all.
 
Old 12-14-2004, 02:34 AM   #13
merlin23
Member
 
Registered: Dec 2004
Location: Vienna
Posts: 46

Original Poster
Rep: Reputation: 15
Hi everybody again...
I was running now the command, but it didn't stop for nearly an hour now...
when I top, I see the bzip2 and tar processes working, but what are they doing? I just tried to extract some kilobytes of data...
My backup-file is about 6 gigs...anybody knows, what tar is doing and why it isn't stopping?
Does it need so long to search through the archive? How can I display the progress?
The same happens, if I run bloat.... It seems to do something, but I don't see any progress...

Please help, it's really an important backup I have to recover...
thx
 
Old 12-14-2004, 08:50 AM   #14
Dave2
LQ Newbie
 
Registered: Dec 2004
Location: Bath, England
Posts: 3

Rep: Reputation: 0
It needs to uncompress the whole bzip2 file before it can actually see what's in the tar archive, so it taking a long time is unavoidable.
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
installing tar.bz2 files M O L8ingN2dust Mandriva 2 03-26-2005 03:46 AM
how do you install tar.bz2 files? Pbguru Linux - Newbie 1 07-25-2004 04:45 PM
Extracting tar.bz2 archive through console grim_chel Linux - Newbie 3 06-28-2004 11:27 AM
extracting tar.bz2.gz files crank Linux - Newbie 5 04-18-2004 11:33 PM
.tar.bz2 files Agileuk Linux - Newbie 7 09-28-2003 12:36 PM


All times are GMT -5. The time now is 07:09 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration