Search code examples
targunzip

How to get path of directory in gunzip bundle


My gunzip structure is like something like this

archive.tgz/manager-34038240834402384/temp1
                                     /temp2/temp4/temp5
                                     /temp3/temp6

I just need the string 'manager-34038240834402384' without extracting whole bundle. How to get it? I tried tar -tvf which gives me whole path, but I just want above string. How to get it?


Solution

  • tar --list -f archive.tgz | head -n 1