Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a bunch of tar files such as a.tar b.tar. I use the following command to merge two tar files :

tar --concatenate --file=a.tar b.tar

However, --concatenate is not support on mac terminal 10.7.4 . What I need to do ?

share|improve this question
    
try tar --file=Merged.tar --create file1.txt file2.txt and tell me if that is what you're looking for. If it is, post back and i will explain what i just showed you. This is basically how you make a "tar ball" –  AlanTuring Nov 9 '12 at 23:48
    
check my edit ? this was helpful @AlanTuring –  catminhvo Nov 9 '12 at 23:51
    
it should still hold true for tar files, give it a swirl. Do you want me to post an answer? –  AlanTuring Nov 9 '12 at 23:53
    
yup, thanks very much @AlanTuring –  catminhvo Nov 9 '12 at 23:57

1 Answer 1

There's a wonderful notion in the tar realm called a tar-ball. Basically it behaves very much the same way a real tarball would. It's sticky and you can throw stuff at it and it will stick!

So the basic Tar usage is:

tar --file=path_to_tarball --subcommand [--subcommand] \ [path_to_payload [path_to_payload]]

now let's see it in an example.

tar --file=Merged.tar --create file1.txt file2.txt

This creates a tarball of the 2 files file1 and file2. As i said earlier you can throw things at the tarball and it will still be fine!

tar --file=Merged.tar --append file3.txt

So as you can see the tarball just gets bigger and bigger!

Since you can imagine this to be a rather big ball lying around after some time, perhaps you want to retrieve something from it after a while? Or maybe even delete it?

To extract a file out of the tar ball we have

tar --file=Merge.tar --extract fileX.txt

and to delete it

tar --file=Megre.tar --delete fileX.txt

for a list of other awesome things you can do with the tar tool, head on over to MacTech

share|improve this answer
    
+1 thanks AlanTuring for the link and some helpful stuff –  catminhvo Nov 10 '12 at 0:17
    
you aint going to accept it lol? –  AlanTuring Nov 10 '12 at 3:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.