Search code examples
unixaix

is there a command to "view the content of a .tar.Z" in UNIX / IBM AIX


(UNIX IBM AIX) When I restore an environment sometimes I just need specific files from a specific directory and as it takes too long to restore and untar the restore I was wondering if there's a command that would list the content of the restore so at least I'll be sure that the files exist.

For now I just untar the restore and wait for hours and then take the files I need.

I already tried wildcards and gtar -tvf

uncompress file.tar.Z|tar tvf -

uncompress file.tar.Z|tar xvf - /path/to/file

uncompress file.tar.Z|tar xvf - uncompress file.tar.Z|tar tvf - |grep wildcard

returns with error file.tar.Z not a compressed file

file file.tar.Z : data or International Language text

this one works for me but only on files that don't exceed 150g in size gtar xvzf file.tar.Z path/ yet most of the files are above 900g

file blocks on fsize=-1

No results till now but I hope I to find something with your help


Solution

  • The command to view the content of this file is:

    uncompress file.tar.Z|tar tvf -
    

    to extract particular file you can use the command:

    uncompress file.tar.Z|tar xvf - /path/to/file
    

    Be aware that you can't use wildcards with UNIX tar

    If you want to use wildcard you should use something like:

    `uncompress file.tar.Z|tar xvf -  `uncompress file.tar.Z|tar tvf - |grep `wildcard`
    

    Also do not forget to update the ulimit so

    file(blocks) 2097151
    

    represent the size bigger than your tar file. The number is in 512 bytes blocks