Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 03-14-2003, 11:17 PM   #1
Registered: Dec 2002
Location: The land of GMT -6
Distribution: OS X, PS2 Linux, Ubuntu, IRIX 6.5
Posts: 399

Rep: Reputation: 31
tar command will only do one file at a time

I'm trying to untar and ungzip three tar.gz . First I tried the command: tar -fixz *.tar.gz, but I found I needed to rearrange the letters. I ended up with tar -xzf ./*tar.gz . It says the files I want to open are "not found in archive." What does that mean?

(BTW, the tar command works when I try to do just one file.)
Old 03-15-2003, 12:51 AM   #2
Senior Member
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
When I use tar, I never use the dash (it's not necessary) and I always use the 'v' option (verbose) mode. So try something like this:

tar xvzf *.tar.gz

If that doesn't work, try doing it specifically for each file. I'd bet one (or more) of them is bad. Then if you're really nosy, you can whip out gzip to test the integrity of the gz file(s) that fail, and maybe even use tar to check the tar archive as well.
Old 03-15-2003, 01:37 AM   #3
Registered: Feb 2003
Location: hampton va
Distribution: ubuntu
Posts: 502

Rep: Reputation: 30
i have run into something like this.
i had to gunzip the files first then untar them. don't know how to get past the multi file prob but maybe if you try this
(after gunzip)
tar -xvf filename.tar filename.tar

now i don't know if this will work or not i have never tried it.
Old 03-15-2003, 02:00 AM   #4
Registered: Jan 2003
Location: Brighton, Michigan
Distribution: FC5
Posts: 114

Rep: Reputation: 15
Try the following:

tar -cvf - files | (cd target directory ; tar xpf -)

This will copy the file to a the new directory in an uncompressed state.

Good luck,

Old 03-15-2003, 08:27 AM   #5
Registered: Jan 2002
Location: Missoula. Montana, USA
Distribution: Slackware (various)
Posts: 460

Rep: Reputation: 42
If you type tar --help, at the begining you will see the following:
GNU `tar' saves many files together into a single tape or disk archive, and
can restore individual files from the archive.

Usage: tar [OPTION]... [FILE]...

tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.
Note that there is one (and only one) option to f which specifies the file (device or whatever) to be processed. Note the the [FILE] has a trailing ... That means you can restore(write) many files.

Try the following:
"echo tar -xzf ./*tar.gz"

You will get something like:
tar -xzf ./tarfile1.tar.gz ./tarfile2.tar.gz ./tarfile3.tar.gz

This means you are telling tar to extract the files ./tarfile2.tar.gz ./tarfile3.tar.gz from the file ./tarfile1.tar.gz. This is why it says .the files are "not found in archive."

If you want to do all the tarfiles at once, try the following:

"for file in *.gz; do tar -xzf $file; done"

Of course, you may want to try the following first: so you can see what would happen

"for file in *.gz; do echo tar -xzf $file; done"

Last edited by fsbooks; 03-15-2003 at 08:28 AM.


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
how can i decompress this tar.tar file? hmmm sounds new.. tar.tar.. help ;) kublador Linux - Software 14 10-25-2016 03:48 AM
gave wrong syntax for tar as tar -cvzf file file.tgz how to recover the file gautham Linux - General 4 04-13-2005 04:15 AM
I need to know the command on how to install tar.bin file lakbay_taodev Linux - Software 9 10-19-2004 07:46 PM
long listing using ls -l command display year or time of the file mnd_world Linux - Newbie 1 05-20-2004 12:39 PM
tar command : error: file changed as we read it sneezesnoeze Linux - General 2 04-05-2004 07:56 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration