How to run a truss command with piped output?


# truss -leDo /tmp/truss.out tar cvf - dirs/ | gzip -1 > archive.tar.gz

I get only the "tar" output in truss, not from gzip!


Have you tried using -f ? It tells truss to follow any children the original command spawns. I'm not sure if that will work because the tar command isn't actually spawning the gzip command.

The other option that might work is:

truss -leDo /tmp/truss.tar.out tar cvf - dirs/ | truss -leDo /tmp/truss.gzip.out gzip -1 > archive.tar.gz

Again, however, I don't know if it will work but this time it's because I don't know what truss does to STDIN.

If both of those fail, you might get somewhere by using the -f option and wrapping both of them in a shell:

truss -leDo /tmp/truss.out ( tar cvf - dirs/ | gzip -1 > archive.tar.gz )

This one requires bash but it could be modified to run under other shells.

All of this is assuming that you want the tar and gzip command separate. If you don't need that, you could just use the -z option to tar to have it do the compression.

| improve this answer | |
  • First option worked! – M_1 Dec 13 '11 at 8:48

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.