Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Untar multiple *.tar.gz.aa *.tar.gz.ab pattern files

Tags:

linux

I tarred a folder and split it into tar.gz files of 200mb when zipping. How can I go about unzipping them? Is there a way I can do this in one command or do I have to do each one separately?

like image 969
Phoenix Devs Avatar asked Jul 05 '16 09:07

Phoenix Devs


People also ask

Can you tar multiple tar files?

If you do need to create the tar files separately, then it is possible to concatenate a pair of tar files using tar -A , or add files / directories using tar -u . However, if you intend to do this, you need to include the directory paths ... otherwise you will get naming collisions.


2 Answers

You even cannot do it separately.

Just undo what you did in reversed order:

  • first concatenate them
  • then unzip them
  • then untar

So you do

cat *.tar.gz.* | zcat | tar xvf -

or, even shorter,

cat *.tar.gz.* | tar xvfz -
like image 121
glglgl Avatar answered Oct 01 '22 00:10

glglgl


You can use the bellow :

$ cat *.tar | tar -xvf - -i

cat command, listed .tar files, then listed files will extracted with tar -xvf - -i command.