Register a domain and help support LQ
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 01-31-2012, 05:56 AM   #1
LQ Newbie
Registered: Sep 2011
Posts: 23

Rep: Reputation: Disabled
Extract from `tar` archive as ordered in --files-from

Following command:

tar -xzf archive.tar.gz -T 'mylist.txt'
does not extract files from "archive.tar.gz" as ordered in 'mylist.txt', but as in order they are compressed.

How can I tell `tar` to extract files as ordered in 'mylist.txt'

Last edited by zx_; 02-04-2012 at 10:09 AM.
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 01-31-2012, 07:26 AM   #2
LQ Newbie
Registered: Mar 2011
Posts: 21

Rep: Reputation: 3
What do you mean by "order" ?
From tar man page:
-T, --files-from F: get names to extract or create from file F
basically, it extracts only files whose names are found in the specified file.
Old 01-31-2012, 09:18 AM   #3
LQ Newbie
Registered: Sep 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
I mean files in archive are compressed like:


and I have file list (mylist.txt):


And want to extract them in that order, not in order as they are compressed

I (noob) was surprised that files aren't extracted in order as they are read from pointed filelist (mylist.txt)

Last edited by zx_; 01-31-2012 at 09:20 AM.
Old 01-31-2012, 11:15 AM   #4
LQ 5k Club
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714Reputation: 714
Why does the order matter, and how can you even tell what order they were extracted in?
Old 01-31-2012, 09:44 PM   #5
LQ Newbie
Registered: Sep 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
If it doesn't matter I wouldn't have asked, but instead answering on more questions while I expected answer to what it seems to me clear question, I'll just thank you for your time.


Last edited by zx_; 01-31-2012 at 09:45 PM.
Old 02-01-2012, 03:28 PM   #6
Senior Member
Registered: Aug 2009
Distribution: CentOS
Posts: 1,624

Rep: Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677Reputation: 677
A tar archive is a linear stream with no overall index. The only way to locate a file is to read the archive from the beginning. It was originally written to work with tape drives (the name comes from "Tape ARchiver"), where seeks are expensive, and is also frequently used in pipelines, where seeks are impossible. It will always list or extract files in the order they appear in the archive.
2 members found this post helpful.
Old 02-04-2012, 10:08 AM   #7
LQ Newbie
Registered: Sep 2011
Posts: 23

Original Poster
Rep: Reputation: Disabled
Thanks. Your reply cleared my question


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
[SOLVED] Extract each file from TAR archive separately zx_ Linux - Newbie 7 01-29-2012 05:53 PM
[SOLVED] tar fails to extract archive containing special characters shadowbox12 Linux - General 2 09-14-2011 07:05 AM
adding files to tar archive pooks Linux - Newbie 3 04-02-2009 07:08 AM
How to extract too large archive (35 GB) .tar file Bharat Kumar pankaj Linux - Server 10 08-19-2008 08:35 AM
tar won't extract a big archive & won't explain... wghay Linux - Software 4 03-05-2006 12:23 PM

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