Bit of a weird one - I've got a honeypot running dionaea, which is a tool that consolidates any binaries that were uploaded to the device in single location (/data/dionaea/binaries).

However, every so often (kind of like logrotate), the /data/dionaea/binaries directory gets gzipped into a file called binaries.tgz.n (where n is incremented each time the rotate happens), and then gets gzipped again into a file called binaries.tgz.n.gz.

I know with a normal tgz or gz archive you can list the contents of the archive with tar tzf /path/to/tgz and gzip --list /path/to/gz (or tar zf /path/to/gz) respectively, but is there a way to pipe the embedded archive into a new tar command to list its contents at the same time (instead of having to actually extract the "outside" gz)?

  • Are you sure it's gzipped? What does file binaries.tgz.1.gz give you? – terdon Oct 9 '19 at 11:09

You can pipe to tar:

gunzip < /path/to/gz | tar tzf -

(Or with GNU tar, you can just use | tar tz.)

| improve this answer | |
  • unfortunately that isn't working for me - see my edit in the OP – ResetACK Oct 9 '19 at 11:08
  • 1
    Uh, why are you using gzip -k --list? – muru Oct 9 '19 at 11:09
  • facedesk you're absolutely right - in my stupor I just used the up-arrow to get a gzip command I had executed previously – ResetACK Oct 9 '19 at 11:11
  • The input is gzipped - binaries.tgz.1.gz contains binaries.tgz.1 which is indeed a compressed archive. – ResetACK Oct 9 '19 at 11:15
  • 1
    Ah! So @ResetACK your system re-gzips already gzipped data? If so, the z is indeed needed. But that's a bit of a strange system... :) – terdon Oct 9 '19 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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